From e3b6dc455ab5c98606e38983bd19426ae346f469 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 9 Sep 2015 10:20:52 +0200 Subject: Reimplement double quote lexing to avoid "implied quote" trick --- tests/lexer/driver.cxx | 1 + tests/quote/buildfile | 4 ++++ tests/quote/test.out | 3 +++ tests/quote/test.sh | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/lexer/driver.cxx b/tests/lexer/driver.cxx index e3543da..a3819f5 100644 --- a/tests/lexer/driver.cxx +++ b/tests/lexer/driver.cxx @@ -99,6 +99,7 @@ main () assert (lex ("f\"oo$ba\"r") == tokens ({"foo", "$", "bar", ""})); assert (lex ("\"foo bar") == tokens ({""})); + assert (lex ("\"foo $") == tokens ({"foo ", "$", ""})); assert (lex ("\"foo $bar") == tokens ({"foo ", "$", ""})); // Combinations. diff --git a/tests/quote/buildfile b/tests/quote/buildfile index 931bc36..6dd22b4 100644 --- a/tests/quote/buildfile +++ b/tests/quote/buildfile @@ -15,4 +15,8 @@ print "[ $bar ]" print "[ $foo $bar ]" print "[ $foo/$bar ]" +print $foo'bar' +print $foo"$bar" +print "$foo"bar + ./: diff --git a/tests/quote/test.out b/tests/quote/test.out index 802f28f..216b1c8 100644 --- a/tests/quote/test.out +++ b/tests/quote/test.out @@ -9,3 +9,6 @@ fo o bar [ bar ] [ fo o bar ] [ fo o/ bar ] +fo obar +fo o bar +fo obar diff --git a/tests/quote/test.sh b/tests/quote/test.sh index 145ea6b..b898b3c 100755 --- a/tests/quote/test.sh +++ b/tests/quote/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -valgrind -q b -q | diff test.out - +valgrind -q b -q | diff -u test.out - -- cgit v1.1