diff --git a/lib/test/names-quoted.conf b/lib/test/names-quoted.conf new file mode 100644 index 00000000..4caf00f5 --- /dev/null +++ b/lib/test/names-quoted.conf @@ -0,0 +1,28 @@ +chip "blah-*" + +# keyword with some quoted names +label "foo" "bar" + +# keyword with escaped newline, names, and whitespace +label \ + "foo" "bar" + +# quoted names with full range of alpha-numeric and underscores +label "abcdefg" "hijklmnop" +label "qrs" "tuv" +label "wx" "yz" +label "a0123456789" "982lksdf" +label "_abcd" "1234_" +label "_" "foo_bar_baz" +label "liajesiajef82197fjadf" "blah" + +# quoted names with escaped characters, like C +# bell, backspace, formfeed, newline, carriage return, h-tab, v-tab, \, ?, ', " +label escapes "\a\b\f\n\r\t\v\\\?\'\"" + +# quoted names with escaped chars that have no special significance +# i.e. the second string below should collapse to "hello" +label more "\h\e\l\l\o" + +# keyword with quoted names, immediate EOF +label "blue" "green" \ No newline at end of file diff --git a/lib/test/names-quoted.conf.stdout b/lib/test/names-quoted.conf.stdout new file mode 100644 index 00000000..5a664286 --- /dev/null +++ b/lib/test/names-quoted.conf.stdout @@ -0,0 +1,53 @@ +1: CHIP +1: NAME: blah-* +2: EOL +4: LABEL +4: NAME: foo +4: NAME: bar +5: EOL +7: LABEL +8: NAME: foo +8: NAME: bar +9: EOL +11: LABEL +11: NAME: abcdefg +11: NAME: hijklmnop +12: EOL +12: LABEL +12: NAME: qrs +12: NAME: tuv +13: EOL +13: LABEL +13: NAME: wx +13: NAME: yz +14: EOL +14: LABEL +14: NAME: a0123456789 +14: NAME: 982lksdf +15: EOL +15: LABEL +15: NAME: _abcd +15: NAME: 1234_ +16: EOL +16: LABEL +16: NAME: _ +16: NAME: foo_bar_baz +17: EOL +17: LABEL +17: NAME: liajesiajef82197fjadf +17: NAME: blah +18: EOL +21: LABEL +21: NAME: escapes +21: NAME:  + \?'" +22: EOL +25: LABEL +25: NAME: more +25: NAME: hello +26: EOL +28: LABEL +28: NAME: blue +28: NAME: green +28: EOL +28: EOF diff --git a/lib/test/test-scanner.pl b/lib/test/test-scanner.pl index d29f3b40..a8ce088a 100755 --- a/lib/test/test-scanner.pl +++ b/lib/test/test-scanner.pl @@ -39,6 +39,8 @@ my @scenarios = ( desc => 'normal, unquoted names' }, { base => 'names-errors', status => 0, desc => 'invalid, unquoted names' }, + { base => 'names-quoted', status => 0, + desc => 'normal, quoted names' }, ); plan tests => ($#scenarios + 1) * 3;