aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/test
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/test')
-rw-r--r--unit-tests/test/script/lexer/command-line.test13
-rw-r--r--unit-tests/test/script/lexer/script-line.test18
-rw-r--r--unit-tests/test/script/parser/cleanup.test48
3 files changed, 55 insertions, 24 deletions
diff --git a/unit-tests/test/script/lexer/command-line.test b/unit-tests/test/script/lexer/command-line.test
index bc791dc..acb7d1d 100644
--- a/unit-tests/test/script/lexer/command-line.test
+++ b/unit-tests/test/script/lexer/command-line.test
@@ -118,12 +118,17 @@ $* <:"1>>>&a b" >>EOO # out-file-app-redirect
'a b'
EOO
-$* <:"&file" >>EOO # file-cleanup
+$* <:"&file" >>EOO # cleanup-always
&
'file'
EOO
-$* <:"&dir/" >>EOO # dir-cleanup
-&
-'dir/'
+$* <:"&?file" >>EOO # cleanup-maybe
+&?
+'file'
+EOO
+
+$* <:"&!file" >>EOO # cleanup-never
+&!
+'file'
EOO
diff --git a/unit-tests/test/script/lexer/script-line.test b/unit-tests/test/script/lexer/script-line.test
index 96eb19c..44f6002 100644
--- a/unit-tests/test/script/lexer/script-line.test
+++ b/unit-tests/test/script/lexer/script-line.test
@@ -112,11 +112,23 @@ $* <"cmd <<<in >>>out 2>>>&err" >>EOO # file-redirect
<newline>
EOO
-$* <"cmd &file &dir/" >>EOO # cleanup
+$* <"cmd &file" >>EOO # cleanup-always
'cmd'
&
'file'
-&
-'dir/'
+<newline>
+EOO
+
+$* <"cmd &?file" >>EOO # cleanup-maybe
+'cmd'
+&?
+'file'
+<newline>
+EOO
+
+$* <"cmd &!file" >>EOO # cleanup-never
+'cmd'
+&!
+'file'
<newline>
EOO
diff --git a/unit-tests/test/script/parser/cleanup.test b/unit-tests/test/script/parser/cleanup.test
index 7fe746d..76614e3 100644
--- a/unit-tests/test/script/parser/cleanup.test
+++ b/unit-tests/test/script/parser/cleanup.test
@@ -1,35 +1,49 @@
-$* <<EOI >>EOO # file-dir
-cmd &file &dir/
+: always
+:
+$* <<EOI >>EOO
+cmd &file
EOI
-cmd &file &dir/
+cmd &file
EOO
-$* <<EOI >>EOO # quote-file-dir
-cmd &"f ile" &"d ir/"
+: maybe
+:
+$* <<EOI >>EOO
+cmd &?file
EOI
-cmd &"f ile" &"d ir/"
+cmd &?file
EOO
-$* <<EOI >>EOO # dup-file
-cmd &file &file
+: never
+:
+$* <<EOI >>EOO
+cmd &!file
EOI
-cmd &file &file
+cmd &!file
EOO
-$* <<EOI 2>>EOE != 0 # file-fail1
+: empty
+:
+$* <<EOI 2>>EOE != 0
+cmd &""
+EOI
+testscript:1:6: error: empty cleanup path
+EOE
+
+: missed-before-token
+: Path missed before command next token
+:
+$* <<EOI 2>>EOE != 0
cmd & >file
EOI
testscript:1:7: error: missing cleanup path
EOE
-$* <<EOI 2>>EOE != 0 # file-fail2
+: missed-before-end
+: Test path missed before end of command
+:
+$* <<EOI 2>>EOE != 0
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