aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/runner/output.test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-03-08 00:39:30 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-03-15 19:52:39 +0300
commit52a29dd64479e9313848941078a2619b47f2c61b (patch)
treed2d83faab7298983793aaf8dd1009d371f324488 /tests/test/script/runner/output.test
parent84dd05fe654eadd755d25932fcd76d1254dc8865 (diff)
Add support for config.test.output variable
Diffstat (limited to 'tests/test/script/runner/output.test')
-rw-r--r--tests/test/script/runner/output.test87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/test/script/runner/output.test b/tests/test/script/runner/output.test
new file mode 100644
index 0000000..f46b6ec
--- /dev/null
+++ b/tests/test/script/runner/output.test
@@ -0,0 +1,87 @@
+# file : tests/test/script/runner/output.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Some of the tests below (*/script-wd, before/*) are probably more appropriate
+# for tests/test/script/script-integration/testscript. Nevertheless let's not
+# spread the feature tests among several places.
+#
+
+.include ../common.test
+
+: after
+:
+{
+ : keep
+ :
+ {
+ : cleanup
+ :
+ $c <'touch a' && $b config.test.output=keep;
+ test -f test/1/a
+
+ : teardown
+ :
+ $c <<EOI && $b config.test.output=keep;
+ +touch a &!a
+ -rm a
+ EOI
+ test -f test/a
+
+ : script-wd
+ :
+ : There is no working directory created for a empty script, so add a dummy
+ : assignment here.
+ :
+ $c <'a=b' && $b config.test.output=keep;
+ test -d test
+ }
+
+ : clean
+ :
+ {
+ : cleanup
+ :
+ $c <'touch a' && $b config.test.output=clean;
+ test -f test/1/a == 1
+
+ : teardown
+ :
+ $c <<EOI && $b config.test.output=clean;
+ +touch a &!a
+ -rm a
+ EOI
+ test -f test/a == 1
+
+ : script-wd
+ :
+ : There is no working directory created for a empty script, so add a dummy
+ : assignment here.
+ :
+ $c <'a=b' && $b config.test.output=clean;
+ test -d test == 1
+ }
+}
+
+: before
+:
+{
+ : fail
+ :
+ mkdir test &!test/;
+ $c <'true' && $b config.test.output=fail@clean 2>>/EOE != 0
+ error: working directory test/ exists at the beginning of the test
+ EOE
+
+ : warn
+ :
+ mkdir test &!test/;
+ $c <'true' && $b config.test.output=warn@clean 2>>/EOE
+ warning: working directory test/ exists at the beginning of the test
+ EOE
+
+ : clean
+ :
+ mkdir test &!test/;
+ $c <'true' && $b config.test.output=clean@clean
+}