diff --git a/test-all-native.sh b/test-all-native.sh index bb88c59..dfb9eec 100755 --- a/test-all-native.sh +++ b/test-all-native.sh @@ -565,6 +565,8 @@ grep -F 'tests/gcode/linuxcnc_fractional_linenumbers.ngc' test-linuxcnc-source-l grep -F 'tests/gcode/linuxcnc_extended_linenumbers.ngc' test-linuxcnc-source-link.sh >/dev/null grep -F 'tests/gcode/linuxcnc_close_and_downcase_words.ngc' test-linuxcnc-source-link.sh >/dev/null 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 for script in \ test-native.sh \ diff --git a/test-linuxcnc-source-link.sh b/test-linuxcnc-source-link.sh index 2823f9c..241d439 100755 --- a/test-linuxcnc-source-link.sh +++ b/test-linuxcnc-source-link.sh @@ -1202,11 +1202,14 @@ done # Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_text() # rejects EOF without the matching percent/program end and overlong file # lines; read_n_number() rejects malformed N-line numbers through -# read_integer_unsigned(). +# read_integer_unsigned(); src/emc/rs274ngc/interp_internal.cc +# close_and_downcase() rejects unclosed and nested parenthesis comments. read_text_error_cases=( "linuxcnc_file_ended_no_program_end_error|File ended with no percent sign" "linuxcnc_file_ended_no_percent_error|File ended with no percent sign" "linuxcnc_bad_n_number_format_error|Bad format unsigned integer" + "linuxcnc_unclosed_comment_error|Unclosed comment found" + "linuxcnc_nested_comment_error|Nested comment found" ) for case in "${read_text_error_cases[@]}"; do fixture=${case%%|*} diff --git a/tests/gcode/linuxcnc_nested_comment_error.ngc b/tests/gcode/linuxcnc_nested_comment_error.ngc new file mode 100644 index 0000000..b279125 --- /dev/null +++ b/tests/gcode/linuxcnc_nested_comment_error.ngc @@ -0,0 +1,2 @@ +G21 G90 +G0 X1 (outer (inner)) diff --git a/tests/gcode/linuxcnc_unclosed_comment_error.ngc b/tests/gcode/linuxcnc_unclosed_comment_error.ngc new file mode 100644 index 0000000..4484093 --- /dev/null +++ b/tests/gcode/linuxcnc_unclosed_comment_error.ngc @@ -0,0 +1,2 @@ +G21 G90 +G0 X1 (missing close