aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-01-20 20:25:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-01-24 14:53:00 +0300
commit28106f96de8ae5cdb3a0ee0e3a8a8185551e3b00 (patch)
tree8b912a7c9a2bd2ba1263695428d8343d022953a5 /tests/test/script
parenteeed734583c2f553e71ae0bd78a4b6e7e4d9cc2b (diff)
Add support for comparison of test command output to a file
Diffstat (limited to 'tests/test/script')
-rw-r--r--tests/test/script/builtin/cat.test2
-rw-r--r--tests/test/script/builtin/touch.test2
-rw-r--r--tests/test/script/common.test6
-rw-r--r--tests/test/script/runner/cleanup.test6
-rw-r--r--tests/test/script/runner/redirect.test50
5 files changed, 44 insertions, 22 deletions
diff --git a/tests/test/script/builtin/cat.test b/tests/test/script/builtin/cat.test
index f5041fc..442ef00 100644
--- a/tests/test/script/builtin/cat.test
+++ b/tests/test/script/builtin/cat.test
@@ -33,7 +33,7 @@ $b
: file
:
$c <<EOI;
-cat <<EOF >>>out;
+cat <<EOF >=out;
foo
bar
EOF
diff --git a/tests/test/script/builtin/touch.test b/tests/test/script/builtin/touch.test
index a80a05c..b3a043e 100644
--- a/tests/test/script/builtin/touch.test
+++ b/tests/test/script/builtin/touch.test
@@ -24,7 +24,7 @@ $b
: Test that existing file touch doesn't fail.
:
$c <<EOI;
-cat <"" >>>a;
+cat <"" >=a;
touch a
EOI
$b
diff --git a/tests/test/script/common.test b/tests/test/script/common.test
index 177fa75..781be30 100644
--- a/tests/test/script/common.test
+++ b/tests/test/script/common.test
@@ -7,7 +7,7 @@
#
+mkdir build
-+cat <<"EOI" >>>build/bootstrap.build
++cat <<"EOI" >=build/bootstrap.build
project = test
amalgamation =
@@ -18,7 +18,7 @@ EOI
# levels up from our working directory.
#
+if! $empty($target)
- cat <<"EOI" >>>build/root.build
+ cat <<"EOI" >=build/root.build
target = \$src_root/../../$string([name] $target)
test{*}: test = \$target
EOI
@@ -31,6 +31,6 @@ end
# Note that the buildfile is clever hack that relies on the first target
# automatically becoming dir{./}'s prerequisite.
#
-c = cat >>>testscript
+c = cat >=testscript
b = $0 --jobs 1 --quiet --buildfile - test <"'test{testscript}: \$target'" \
&?test/***
diff --git a/tests/test/script/runner/cleanup.test b/tests/test/script/runner/cleanup.test
index ed724ee..1c3ccae 100644
--- a/tests/test/script/runner/cleanup.test
+++ b/tests/test/script/runner/cleanup.test
@@ -46,7 +46,7 @@ b += --no-column
:
$c <<EOI;
touch a &!a;
- $* -o foo >>>&a;
+ $* -o foo >+a;
rm a
EOI
$b
@@ -224,7 +224,7 @@ $b
:
: Test an implicit cleanup being overwritten with the explicit one,
:
-$c <'$* -o foo >>>a &!a';
+$c <'$* -o foo >=a &!a';
$b 2>>/EOE != 0
testscript:1: error: registered for cleanup directory test/1/ is not empty
EOE
@@ -235,7 +235,7 @@ EOE
:
$c <<EOO;
$* &!a;
-$* -o foo >>>a
+$* -o foo >=a
EOO
$b 2>>/EOE != 0
testscript:2: error: registered for cleanup directory test/1/ is not empty
diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test
index e2d765c..f32492a 100644
--- a/tests/test/script/runner/redirect.test
+++ b/tests/test/script/runner/redirect.test
@@ -465,31 +465,53 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
: file
:
{
- : in-out
+ : in
:
$c <<EOI;
- $* -o foo >>>out;
+ $* -o foo >=out;
$* -i 1 <<<out >foo
EOI
$b
- : append
+ : out
:
- $c <<EOI;
- $* -o foo >>>out;
- $* -e bar 2>>>&out;
- $* -i 1 <<<out >>EOO
- foo
- bar
- EOO
- EOI
- $b
+ {
+ : match
+ :
+ $c <<EOI;
+ $* -o foo >=out;
+ $* -e bar 2>+out;
+ $* -i 1 <<EOF >>>out
+ foo
+ bar
+ EOF
+ EOI
+ $b
+
+ : mismatch
+ :
+ $c <<EOI;
+ $* -o foo >=out;
+ $* -o bar >>>out
+ EOI
+ $b 2>>/~%EOE%d != 0
+ %testscript:2: error: ../../../../../driver(.exe)? stdout doesn't match the expected output%
+ info: stdout: test/1/stdout-2
+ info: expected stdout: test/1/out
+ info: stdout diff: test/1/stdout-2.diff
+ %--- \.*%
+ %\+\+\+ \.*%
+ %@@ \.*%
+ -foo
+ +bar
+ EOE
+ }
: merge
:
$c <<EOI;
- $* -o foo -e bar 2>&1 >>>out;
- $* -e baz -o biz 1>&2 2>>>&out;
+ $* -o foo -e bar 2>&1 >=out;
+ $* -e baz -o biz 1>&2 2>+out;
$* -i 1 <<<out >>EOO
foo
bar