diff options
Diffstat (limited to 'unit-tests/test')
-rw-r--r-- | unit-tests/test/script/lexer/command-line.test | 10 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/script-line.test | 9 | ||||
-rw-r--r-- | unit-tests/test/script/parser/buildfile | 4 | ||||
-rw-r--r-- | unit-tests/test/script/parser/cleanup.test | 35 |
4 files changed, 56 insertions, 2 deletions
diff --git a/unit-tests/test/script/lexer/command-line.test b/unit-tests/test/script/lexer/command-line.test index 4a71d46..bc791dc 100644 --- a/unit-tests/test/script/lexer/command-line.test +++ b/unit-tests/test/script/lexer/command-line.test @@ -117,3 +117,13 @@ $* <:"1>>>&a b" >>EOO # out-file-app-redirect >>>& 'a b' EOO + +$* <:"&file" >>EOO # file-cleanup +& +'file' +EOO + +$* <:"&dir/" >>EOO # dir-cleanup +& +'dir/' +EOO diff --git a/unit-tests/test/script/lexer/script-line.test b/unit-tests/test/script/lexer/script-line.test index 36d440c..6c5038a 100644 --- a/unit-tests/test/script/lexer/script-line.test +++ b/unit-tests/test/script/lexer/script-line.test @@ -92,3 +92,12 @@ $* <"cmd <<<in >>>out 2>>>&err" >>EOO # file-redirect 'err' <newline> EOO + +$* <"cmd &file &dir/" >>EOO # cleanup +'cmd' +& +'file' +& +'dir/' +<newline> +EOO diff --git a/unit-tests/test/script/parser/buildfile b/unit-tests/test/script/parser/buildfile index b053971..e64159e 100644 --- a/unit-tests/test/script/parser/buildfile +++ b/unit-tests/test/script/parser/buildfile @@ -11,7 +11,7 @@ filesystem config/{utility init operation} dump types-parsers \ test/{target script/{token lexer parser script}} exe{driver}: cxx{driver} ../../../../build2/cxx{$src} $libs \ -test{pre-parse expansion redirect here-document command-re-parse scope \ - setup-teardown} +test{cleanup command-re-parse expansion here-document pre-parse redirect \ + scope setup-teardown} include ../../../../build2/ diff --git a/unit-tests/test/script/parser/cleanup.test b/unit-tests/test/script/parser/cleanup.test new file mode 100644 index 0000000..7fe746d --- /dev/null +++ b/unit-tests/test/script/parser/cleanup.test @@ -0,0 +1,35 @@ +$* <<EOI >>EOO # file-dir +cmd &file &dir/ +EOI +cmd &file &dir/ +EOO + +$* <<EOI >>EOO # quote-file-dir +cmd &"f ile" &"d ir/" +EOI +cmd &"f ile" &"d ir/" +EOO + +$* <<EOI >>EOO # dup-file +cmd &file &file +EOI +cmd &file &file +EOO + +$* <<EOI 2>>EOE != 0 # file-fail1 +cmd & >file +EOI +testscript:1:7: error: missing cleanup path +EOE + +$* <<EOI 2>>EOE != 0 # file-fail2 +cmd & +EOI +testscript:1:6: error: missing cleanup path +EOE + +$* <<EOI 2>>EOE != 0 # file-fail3 +cmd &"" +EOI +testscript:1:6: error: empty cleanup path +EOE |