diff --git a/test-all-native.sh b/test-all-native.sh index dfb9eec..6206704 100755 --- a/test-all-native.sh +++ b/test-all-native.sh @@ -567,6 +567,8 @@ grep -F 'tests/gcode/linuxcnc_close_and_downcase_words.ngc' test-linuxcnc-source grep -F 'tests/gcode/linuxcnc_percent_file_ignores_trailing.ngc' test-linuxcnc-source-link.sh >/dev/null grep -F 'linuxcnc_unclosed_comment_error|Unclosed comment found' test-linuxcnc-source-link.sh >/dev/null grep -F 'linuxcnc_nested_comment_error|Nested comment found' test-linuxcnc-source-link.sh >/dev/null +grep -F 'linuxcnc_commented_percent_error|Bad character '\''%'\'' used' test-linuxcnc-source-link.sh >/dev/null +grep -F 'linuxcnc_mid_program_percent_error|Bad character '\''%'\'' used' test-linuxcnc-source-link.sh >/dev/null for script in \ test-native.sh \ diff --git a/test-linuxcnc-source-link.sh b/test-linuxcnc-source-link.sh index 241d439..4543e68 100755 --- a/test-linuxcnc-source-link.sh +++ b/test-linuxcnc-source-link.sh @@ -1022,9 +1022,13 @@ done # read_one_item() then uses the default reader table from interp_array.cc # and rejects unknown item-start characters, including middle-of-line or # comment-prefixed N/O words, midline O-words, bracket expressions, naked numbers, and -# non-leading ATAN argument slashes. +# non-leading ATAN argument slashes. LinuxCNC src/emc/rs274ngc/rs274ngc_pre.cc +# open() only enables percent-file mode when the first nonblank line contains +# only '%', so commented or non-opening percent lines reach read_one_item(). bad_character_error_cases=( "linuxcnc_bad_character_bang_error|Bad character '!' used" + "linuxcnc_commented_percent_error|Bad character '%' used" + "linuxcnc_mid_program_percent_error|Bad character '%' used" "linuxcnc_bad_character_middle_n_word_error|Bad character 'n' used" "linuxcnc_comment_prefixed_n_word_error|Bad character 'n' used" "linuxcnc_comment_prefixed_spaced_n_word_error|Bad character 'n' used" diff --git a/tests/gcode/linuxcnc_commented_percent_error.ngc b/tests/gcode/linuxcnc_commented_percent_error.ngc new file mode 100644 index 0000000..2a838e6 --- /dev/null +++ b/tests/gcode/linuxcnc_commented_percent_error.ngc @@ -0,0 +1,3 @@ +% (not a delimiter) +G0 X1 +% diff --git a/tests/gcode/linuxcnc_mid_program_percent_error.ngc b/tests/gcode/linuxcnc_mid_program_percent_error.ngc new file mode 100644 index 0000000..19388c8 --- /dev/null +++ b/tests/gcode/linuxcnc_mid_program_percent_error.ngc @@ -0,0 +1,3 @@ +G0 X1 +% +G0 Y2