Import LinuxCNC source tree
This commit is contained in:
5
tests/inifile/line_endings/README
Normal file
5
tests/inifile/line_endings/README
Normal file
@@ -0,0 +1,5 @@
|
||||
The INI parser in LinuxCNC handles UNIX line endings, '\n' and DOS '\r\n', with
|
||||
a warning. The parser aborts when it encounters classic MAC OS line endings '\r'.
|
||||
|
||||
The INI files is created in the test script, since several tools automatically
|
||||
fixes the line endings.
|
||||
2
tests/inifile/line_endings/expected
Normal file
2
tests/inifile/line_endings/expected
Normal file
@@ -0,0 +1,2 @@
|
||||
value1
|
||||
value1
|
||||
16
tests/inifile/line_endings/test.sh
Executable file
16
tests/inifile/line_endings/test.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Manually create INI files with different line endings.
|
||||
lf="[section1]\nkey1=value1\n"
|
||||
cr="[section1]\rkey1=value1\r"
|
||||
crlf="[section1]\r\nkey1=value1\r\n"
|
||||
|
||||
echo -e "$lf" > "lf.ini"
|
||||
echo -e "$cr" > "cr.ini"
|
||||
echo -e "$crlf" > "crlf.ini"
|
||||
|
||||
inivar -ini lf.ini -var key1 # Should be successful.
|
||||
inivar -ini cr.ini -var key1 # Should fail.
|
||||
inivar -ini crlf.ini -var key1 # Should be successful.
|
||||
|
||||
rm -f lf.ini cr.ini crlf.ini
|
||||
Reference in New Issue
Block a user