aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/runner
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-12-31 03:14:50 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-01-05 15:30:49 +0300
commitb917233d4b618d587f569706d8d528b051efdba4 (patch)
tree1ff132a7299cb962a5be4be3a4b0fadeea2141f3 /tests/test/script/runner
parente1837dc7da78055ab3e355c3e941a7415146c1b8 (diff)
Tests cleanup
Diffstat (limited to 'tests/test/script/runner')
-rw-r--r--tests/test/script/runner/cleanup.test414
-rw-r--r--tests/test/script/runner/redirect.test647
-rw-r--r--tests/test/script/runner/status.test54
3 files changed, 573 insertions, 542 deletions
diff --git a/tests/test/script/runner/cleanup.test b/tests/test/script/runner/cleanup.test
index 6f6bb95..aec3f20 100644
--- a/tests/test/script/runner/cleanup.test
+++ b/tests/test/script/runner/cleanup.test
@@ -6,76 +6,221 @@
b += --no-column
-# Valid cleanups.
-#
# @@ TODO: $c <'$* -f a &a' && $b
#
-: file-always
-:
-$c <'$* -f a &a';
-$b
-
-: file-maybe
-:
-$c <'$* &?a';
-$b
-
-: file-never
-:
-$c <'$* &!a';
-$b
-
-: file-implicit
-:
-: Test that a file created out of the testscript working directory is not
-: implicitly registered for cleanup. If it were, the test would fail due to
-: rm failure.
-:
-$c <'touch ../../a';
-$b;
-rm a
-
-: file-append
-:
-: Test that file append redirect does not not register cleanup. If it did,
-: that cleanup would fail as the file would be already deleted by rm.
-:
-$c <<EOI;
-touch a &!a;
-$* -o foo >>>&a;
-rm a
-EOI
-$b
-
-: dir-always
-:
-$c <'$* -d a &a/';
-$b
-
-: dir-maybe
-:
-$c <'$* &?a/';
-$b
-
-: dir-implicit
-:
-: Test that a directory created out of the testscript working directory is not
-: implicitly registered for cleanup. If it were, the test would fail due to
-: rm failure.
-:
-$c <'mkdir ../../a';
-$b;
-rm -r a
-: wildcard-always
-:
-$c <'$* -d a/b -f a/b/c &a/***';
-$b
-
-: wildcard-maybe
-:
-$c <'$* &?a/***';
-$b
+: file
+:
+{
+ : always
+ :
+ $c <'$* -f a &a';
+ $b
+
+ : maybe
+ :
+ $c <'$* &?a';
+ $b
+
+ : never
+ :
+ $c <'$* &!a';
+ $b
+
+ : implicit
+ :
+ : Test that a file created out of the testscript working directory is not
+ : implicitly registered for cleanup. If it were, the test would fail due to
+ : the file absence at the cleanup time.
+ :
+ $c <<EOI;
+ touch ../../a;
+ rm -f ../../a
+ EOI
+ $b
+
+ : append
+ :
+ : Test that file append redirect does not not register cleanup. If it did,
+ : that cleanup would fail as the file would be already deleted by rm.
+ :
+ $c <<EOI;
+ touch a &!a;
+ $* -o foo >>>&a;
+ rm a
+ EOI
+ $b
+
+ : not-exists
+ :
+ : Test cleanup of non-existing file.
+ :
+ $c <'$* &a';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: registered for cleanup file test[/\\]1[/\\]a does not exist%
+ EOE
+
+ : out-wd
+ :
+ : Test explicit cleanup of a file out of the testscript working directory.
+ :
+ $c <'$* &../../a';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: file cleanup \.\.[/\\]\.\.[/\\]a is out of working directory test[/\\]%
+ EOE
+
+ : in-wd
+ :
+ : Test cleanup explicit registration of a file being outside the test working
+ : directory but inside the script working directory.
+ :
+ $c <'$* &../a';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: registered for cleanup file test[/\\]a does not exist%
+ EOE
+
+ : not-file
+ :
+ : Test cleanup of a directory as a file. Note that there is an optional
+ : trailing blank line in the regex that matches the newline added by msvcrt
+ : as a part of the error description.
+ :
+ $c <'$* -d a &a';
+ $b 2>>~%EOE% != 0
+ %error: unable to remove file test[/\\]1[/\\]a: .+%
+ %%?
+ EOE
+}
+
+: dir
+:
+{
+ : always
+ :
+ $c <'$* -d a &a/';
+ $b
+
+ : maybe
+ :
+ $c <'$* &?a/';
+ $b
+
+ : implicit
+ :
+ : Test that a directory created out of the testscript working directory is
+ : not implicitly registered for cleanup. If it were, the test would fail due
+ : to the directory absence at the cleanup time.
+ :
+ $c <<EOI;
+ mkdir ../../a;
+ rm -r -f ../../a
+ EOI
+ $b
+
+ : not-exists
+ :
+ : Test cleanup of non-existing directory.
+ :
+ $c <'$* &a/';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: registered for cleanup directory test[/\\]1[/\\]a[/\\] does not exist%
+ EOE
+
+ : out-wd
+ :
+ : Test cleanup of a directory out of the testscript working directory.
+ :
+ $c <'$* &../../a/';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: directory cleanup \.\.[/\\]\.\.[/\\]a[/\\] is out of working directory test[/\\]%
+ EOE
+
+ : in-wd
+ :
+ : Test cleanup explicit registration of a directory being outside the test
+ : working directory but inside the testscript working directory.
+ :
+ $c <'$* &../a/';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: registered for cleanup directory test[/\\]a[/\\] does not exist%
+ EOE
+
+ : not-empty
+ :
+ : Test cleanup of a non-empty directory.
+ :
+ $c <'$* -d a -f a/b &a/';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: registered for cleanup directory test[/\\]1[/\\]a[/\\] is not empty%
+ EOE
+
+ : not-dir
+ :
+ : Test cleanup of a file as a directory. Note that there is an optional
+ : trailing blank line in the regex that matches the newline added by msvcrt
+ : as a part of the error description.
+ :
+ $c <'$* -f a &a/';
+ $b 2>>~%EOE% != 0
+ %error: unable to remove directory test[/\\]1[/\\]a[/\\]: .+%
+ %%?
+ EOE
+}
+
+: wildcard
+:
+{
+ : always
+ :
+ $c <'$* -d a/b -f a/b/c &a/***';
+ $b
+
+ : maybe
+ :
+ $c <'$* &?a/***';
+ $b
+
+ : not-exists
+ :
+ : Test cleanup of a wildcard not matching any directory.
+ :
+ $c <'$* &a/***';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: registered for cleanup wildcard test[/\\]1[/\\]a[/\\]\*\*\* doesn't match a directory%
+ EOE
+
+ : out-wd
+ :
+ : Test cleanup of a wildcard out of the testscript working directory.
+ :
+ $c <'$* &../../a/***';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: wildcard cleanup \.\.[/\\]\.\.[/\\]a[/\\]\*\*\* is out of working directory test[/\\]%
+ EOE
+
+ : in-wd
+ :
+ : Test cleanup registration of a wildcard matching the directory that being
+ : outside the test working directory is inside the testscript working
+ : directory.
+ :
+ $c <'$* &../a/***';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: registered for cleanup wildcard test[/\\]a[/\\]\*\*\* doesn't match a directory%
+ EOE
+
+ : not-dir
+ :
+ : Test cleanup of a file as a wildcard. Note that there is an optional
+ : trailing blank line in the regex that matches the newline added by msvcrt
+ : as a part of the error description.
+ :
+ $c <'$* -f a &a/***';
+ $b 2>>~%EOE% != 0
+ %error: unable to remove directory test[/\\]1[/\\]a[/\\]: .+%
+ %%?
+ EOE
+}
: order
:
@@ -84,141 +229,6 @@ $b
$c <'$* -d a/b &a/ &a/b/';
$b
-# Invalid cleanups.
-#
-: file-not-exists
-:
-: Test cleanup of non-existing file.
-:
-$c <'$* &a';
-$b 2>>~%EOE% != 0
-%testscript:1: error: registered for cleanup file test[/\\]1[/\\]a does not exist%
-EOE
-
-: file-out-wd
-:
-: Test explicit cleanup of a file out of the testscript working directory.
-:
-$c <'$* &../../a';
-$b 2>>~%EOE% != 0
-%testscript:1: error: file cleanup \.\.[/\\]\.\.[/\\]a is out of working directory test[/\\]%
-EOE
-
-: file-in-wd
-:
-: Test cleanup explicit registration of a file being outside the test working
-: directory but inside the script working directory.
-:
-$c <'$* &../a';
-$b 2>>~%EOE% != 0
-%testscript:1: error: registered for cleanup file test[/\\]a does not exist%
-EOE
-
-: not-file
-:
-: Test cleanup of a directory as a file.
-:
-: Note that there is an optional trailing blank line in the regex that matches
-: the newline added by msvcrt as a part of the error description.
-:
-$c <'$* -d a &a';
-$b 2>>~%EOE% != 0
-%error: unable to remove file test[/\\]1[/\\]a: .+%
-%%?
-EOE
-
-: dir-not-exists
-:
-: Test cleanup of non-existing directory.
-:
-$c <'$* &a/';
-$b 2>>~%EOE% != 0
-%testscript:1: error: registered for cleanup directory test[/\\]1[/\\]a[/\\] does not exist%
-EOE
-
-: dir-out-wd
-:
-: Test cleanup of a directory out of the testscript working directory.
-:
-$c <'$* &../../a/';
-$b 2>>~%EOE% != 0
-%testscript:1: error: directory cleanup \.\.[/\\]\.\.[/\\]a[/\\] is out of working directory test[/\\]%
-EOE
-
-: dir-in-wd
-:
-: Test cleanup explicit registration of a directory being outside the test
-: working directory but inside the testscript working directory.
-:
-$c <'$* &../a/';
-$b 2>>~%EOE% != 0
-%testscript:1: error: registered for cleanup directory test[/\\]a[/\\] does not exist%
-EOE
-
-: dir-not-empty
-:
-: Test cleanup of a non-empty directory.
-:
-$c <'$* -d a -f a/b &a/';
-$b 2>>~%EOE% != 0
-%testscript:1: error: registered for cleanup directory test[/\\]1[/\\]a[/\\] is not empty%
-EOE
-
-: not-dir
-:
-: Test cleanup of a file as a directory.
-:
-: Note that there is an optional trailing blank line in the regex that matches
-: the newline added by msvcrt as a part of the error description.
-:
-$c <'$* -f a &a/';
-$b 2>>~%EOE% != 0
-%error: unable to remove directory test[/\\]1[/\\]a[/\\]: .+%
-%%?
-EOE
-
-: wildcard-not-exists
-:
-: Test cleanup of a wildcard not matching any directory.
-:
-$c <'$* &a/***';
-$b 2>>~%EOE% != 0
-%testscript:1: error: registered for cleanup wildcard test[/\\]1[/\\]a[/\\]\*\*\* doesn't match a directory%
-EOE
-
-: wildcard-out-wd
-:
-: Test cleanup of a wildcard out of the testscript working directory.
-:
-$c <'$* &../../a/***';
-$b 2>>~%EOE% != 0
-%testscript:1: error: wildcard cleanup \.\.[/\\]\.\.[/\\]a[/\\]\*\*\* is out of working directory test[/\\]%
-EOE
-
-: wildcard-in-wd
-:
-: Test cleanup registration of a wildcard matching the directory that being
-: outside the test working directory is inside the testscript working
-: directory.
-:
-$c <'$* &../a/***';
-$b 2>>~%EOE% != 0
-%testscript:1: error: registered for cleanup wildcard test[/\\]a[/\\]\*\*\* doesn't match a directory%
-EOE
-
-: wildcard-not-dir
-:
-: Test cleanup of a file as a wildcard.
-:
-: Note that there is an optional trailing blank line in the regex that matches
-: the newline added by msvcrt as a part of the error description.
-:
-$c <'$* -f a &a/***';
-$b 2>>~%EOE% != 0
-%error: unable to remove directory test[/\\]1[/\\]a[/\\]: .+%
-%%?
-EOE
-
: implicit-overwrite
:
: Test an implicit cleanup being overwritten with the explicit one,
diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test
index 7aa4ec0..64b11ea 100644
--- a/tests/test/script/runner/redirect.test
+++ b/tests/test/script/runner/redirect.test
@@ -6,365 +6,382 @@
b += --no-column
-# null-redirect tests.
-#
-: out-null
-:
-$c <'$* -o foo >-';
-$b
-
-: err-null
+: null
:
-$c <'$* -e foo 2>-';
-$b
+{
+ : out
+ :
+ $c <'$* -o foo >-';
+ $b
-# Here-string tests.
-#
-: in-str
-:
-$c <'$* -i 0 <foo';
-$b
+ : err
+ :
+ $c <'$* -e foo 2>-';
+ $b
+}
-: out-str
+: str
:
-$c <'$* -o foo >foo';
-$b
+{
+ : in
+ :
+ $c <'$* -i 0 <foo';
+ $b
-: err-str
-:
-$c <'$* -e foo 2>foo';
-$b
+ : out
+ :
+ $c <'$* -o foo >foo';
+ $b
-: inout-str
-:
-$c <'$* -i 1 <foo >foo';
-$b
+ : err
+ :
+ $c <'$* -e foo 2>foo';
+ $b
-: inout-str-fail
-:
-$c <'$* -i 1 <foo >bar';
-$b 2>>~%EOE% != 0
-%testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? stdout doesn't match the expected output%
-% info: stdout: test[/\\]1[/\\]stdout%
-% info: expected stdout: test[/\\]1[/\\]stdout\.orig%
-% info: stdout diff: test[/\\]1[/\\]stdout\.diff%
-% info: stdin: test[/\\]1[/\\]stdin%
-%--- .*%
-%\+\+\+ .*%
-%@@ .*%
--bar
-+foo
-EOE
-
-: inerr-str
-:
-$c <'$* -i 2 <foo 2>foo';
-$b
+ : inout
+ :
+ $c <'$* -i 1 <foo >foo';
+ $b
-: inout-err-str
-:
-$c <'$* -i 1 -e bar <foo 1>foo 2>bar';
-$b
+ : inout-fail
+ :
+ $c <'$* -i 1 <foo >bar';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? stdout doesn't match the expected output%
+ % info: stdout: test[/\\]1[/\\]stdout%
+ % info: expected stdout: test[/\\]1[/\\]stdout\.orig%
+ % info: stdout diff: test[/\\]1[/\\]stdout\.diff%
+ % info: stdin: test[/\\]1[/\\]stdin%
+ %--- .*%
+ %\+\+\+ .*%
+ %@@ .*%
+ -bar
+ +foo
+ EOE
-# Here-document tests.
-#
-: in-doc
-:
-$c <<EOI;
-$* -i 0 <<EOO
-foo
-bar
-EOO
-EOI
-$b
-
-: out-doc
-:
-$c <<EOI;
-$* -o foo -o bar >>EOO
-foo
-bar
-EOO
-EOI
-$b
-
-: err-doc
-:
-$c <<EOI;
-$* -e foo -e bar 2>>EOO
-foo
-bar
-EOO
-EOI
-$b
-
-: inout-doc
-:
-$c <<EOI;
-$* -i 1 <<EOF >>EOO
-foo
-bar
-EOF
-foo
-bar
-EOO
-EOI
-$b
-
-: inerr-doc
-:
-$c <<EOI;
-$* -i 2 <<EOF 2>>EOE
-foo
-bar
-EOF
-foo
-bar
-EOE
-EOI
-$b
-
-: empty-str-doc
-:
-$c <<EOI;
-$* -i 1 -e "" <<EOF >>EOO 2>""
-EOF
-EOO
-EOI
-$b
-
-: nl-containing-doc
-:
-$c <<EOI;
-$* -i 1 <<EOF >>EOO
+ : inerr
+ :
+ $c <'$* -i 2 <foo 2>foo';
+ $b
-EOF
+ : inout-err
+ :
+ $c <'$* -i 1 -e bar <foo 1>foo 2>bar';
+ $b
-EOO
-EOI
-$b
+ : empty
+ :
+ $c <'$* -o "" >""';
+ $b
-: doc-fail-largediff
-:
-: Make sure that the large (>4KB) expected/real output difference is not
-: printed as a part of diagnostics.
-:
-$c <<EOI;
-s="------------------------------------------------------------------------";
-s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s";
-$* -i 1 <<"EOF" >>"EOO"
-$s
-EOF
-x$s
-EOO
-EOI
-$b 2>>~%EOE% != 0
-%testscript:3: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? stdout doesn't match the expected output%
-% info: stdout: test[/\\]1[/\\]stdout%
-% info: expected stdout: test[/\\]1[/\\]stdout\.orig%
-% info: stdout diff: test[/\\]1[/\\]stdout\.diff%
-% info: stdin: test[/\\]1[/\\]stdin%
-EOE
-
-# No-newline tests.
-#
-: no-newline-str
-:
-$c <'$* -i 1 <:"foo" >:"foo"';
-$b
+ : no-newline
+ :
+ $c <'$* -i 1 <:"foo" >:"foo"';
+ $b
-: no-newline-empty-str
-:
-$c <'$* -i 1 <:"" >:""';
-$b
+ : no-newline-empty
+ :
+ $c <'$* -i 1 <:"" >:""';
+ $b
-: no-newline-str-fail1
-:
-$c <'$* -i 1 <:"foo" >"foo"';
-$b 2>>~/EOE/ != 0
-/testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
-/.{7}
--foo
-+foo
-\ No newline at end of file
-EOE
-
-: no-newline-str-fail2
-:
-$c <'$* -i 1 <"foo" >:"foo"';
-$b 2>>~/EOE/ != 0
-/testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
-/.{7}
--foo
-\ No newline at end of file
-+foo
-EOE
-
-: no-newline-doc
-:
-$c <<EOI;
-$* -i 1 <<:EOF >>:EOO
-foo
-EOF
-foo
-EOO
-EOI
-$b
-
-: no-newline-doc-fail1
-:
-$c <<EOI;
-$* -i 1 <<:EOF >>EOO
-foo
-EOF
-foo
-EOO
-EOI
-$b 2>>~/EOE/ != 0
-/testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
-/.{7}
--foo
-+foo
-\ No newline at end of file
-EOE
-
-: no-newline-doc-fail2
-:
-$c <<EOI;
-$* -i 1 <<EOF >>:EOO
-foo
-EOF
-foo
-EOO
-EOI
-$b 2>>~/EOE/ != 0
-/testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
-/.{7}
--foo
-\ No newline at end of file
-+foo
-EOE
-
-: no-newline-empty-str-doc
-:
-$c <<EOI;
-$* -i 1 <<:EOF >>:EOO 2>:""
-EOF
-EOO
-EOI
-$b
-
-: no-newline-nl-cont-doc
-:
-$c <<EOI;
-$* -i 1 <<:EOF >>:EOO
+ : no-newline-fail1
+ :
+ $c <'$* -i 1 <:"foo" >"foo"';
+ $b 2>>~/EOE/ != 0
+ /testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
+ /.{7}
+ -foo
+ +foo
+ \ No newline at end of file
+ EOE
-EOF
+ : no-newline-fail2
+ :
+ $c <'$* -i 1 <"foo" >:"foo"';
+ $b 2>>~/EOE/ != 0
+ /testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
+ /.{7}
+ -foo
+ \ No newline at end of file
+ +foo
+ EOE
-EOO
-EOI
-$b
+ : merge
+ :
+ $c <<EOI;
+ $* -o foo -e bar 2>>EOE 1>&2
+ foo
+ bar
+ EOE
+ EOI
+ $b
+}
-# Merge tests.
-#
-: merge-str
-:
-$c <<EOI;
-$* -o foo -e bar 2>>EOE 1>&2
-foo
-bar
-EOE
-EOI
-$b
-
-: merge-doc
-:
-$c <<EOI;
-$* -i 1 <<EOF -e baz >>EOO 2>&1
-foo
-bar
-EOF
-foo
-bar
-baz
-EOO
-EOI
-$b
-
-# File tests.
-#
-: file
-:
-$c <<EOI;
-$* -o foo >>>out;
-$* -e bar 2>>>&out;
-$* -i 1 <<<out >>EOO
-foo
-bar
-EOO
-EOI
-$b
-
-: merge-file
-:
-$c <<EOI;
-$* -o foo -e bar 2>&1 >>>out;
-$* -e baz -o biz 1>&2 2>>>&out;
-$* -i 1 <<<out >>EOO
-foo
-bar
-baz
-biz
-EOO
-EOI
-$b
-
-# Regex tests.
-#
-: out-str-regex
+: doc
:
{
- : match
+ : in
+ :
+ $c <<EOI;
+ $* -i 0 <<EOO
+ foo
+ bar
+ EOO
+ EOI
+ $b
+
+ : out
+ :
+ $c <<EOI;
+ $* -o foo -o bar >>EOO
+ foo
+ bar
+ EOO
+ EOI
+ $b
+
+ : err
:
- $c <'$* -o foo >~/Foo?/i';
+ $c <<EOI;
+ $* -e foo -e bar 2>>EOO
+ foo
+ bar
+ EOO
+ EOI
+ $b
+
+ : inout
+ :
+ $c <<EOI;
+ $* -i 1 <<EOF >>EOO
+ foo
+ bar
+ EOF
+ foo
+ bar
+ EOO
+ EOI
+ $b
+
+ : inerr
+ :
+ $c <<EOI;
+ $* -i 2 <<EOF 2>>EOE
+ foo
+ bar
+ EOF
+ foo
+ bar
+ EOE
+ EOI
+ $b
+
+ : empty
+ :
+ $c <<EOI;
+ $* -i 1 <<EOF >>EOO
+ EOF
+ EOO
+ EOI
+ $b
+
+ : extra-newline
+ :
+ $c <<EOI;
+ $* -i 1 <<EOF >>EOO
+
+ EOF
+
+ EOO
+ EOI
+ $b
+
+ : no-newline
+ :
+ $c <<EOI;
+ $* -i 1 <<:EOF >>:EOO
+ foo
+ EOF
+ foo
+ EOO
+ EOI
+ $b
+
+ : no-newline-fail1
+ :
+ $c <<EOI;
+ $* -i 1 <<:EOF >>EOO
+ foo
+ EOF
+ foo
+ EOO
+ EOI
+ $b 2>>~/EOE/ != 0
+ /testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
+ /.{7}
+ -foo
+ +foo
+ \ No newline at end of file
+ EOE
+
+ : no-newline-fail2
+ :
+ $c <<EOI;
+ $* -i 1 <<EOF >>:EOO
+ foo
+ EOF
+ foo
+ EOO
+ EOI
+ $b 2>>~/EOE/ != 0
+ /testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
+ /.{7}
+ -foo
+ \ No newline at end of file
+ +foo
+ EOE
+
+ : no-newline-empty
+ :
+ $c <<EOI;
+ $* -i 1 <<:EOF >>:EOO
+ EOF
+ EOO
+ EOI
+ $b
+
+ : no-newline-extra-newline
+ :
+ $c <<EOI;
+ $* -i 1 <<:EOF >>:EOO
+
+ EOF
+
+ EOO
+ EOI
+ $b
+
+ : merge
+ :
+ $c <<EOI;
+ $* -i 1 <<EOF -e baz >>EOO 2>&1
+ foo
+ bar
+ EOF
+ foo
+ bar
+ baz
+ EOO
+ EOI
$b
- : fail
+ : large-diff
+ :
+ : Make sure that the large (>4KB) expected/real output difference is not
+ : printed as a part of the diagnostics.
:
- $c <'$* -o fooo >~/Foo?/i';
+ $c <<EOI;
+ s="------------------------------------------------------------------------";
+ s="$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s";
+ $* -i 1 <<"EOF" >>"EOO"
+ $s
+ EOF
+ x$s
+ EOO
+ EOI
$b 2>>~%EOE% != 0
- %testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? stdout doesn't match the regex%
+ %testscript:3: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? stdout doesn't match the expected output%
% info: stdout: test[/\\]1[/\\]stdout%
- % info: stdout regex: test[/\\]1[/\\]stdout\.regex%
+ % info: expected stdout: test[/\\]1[/\\]stdout\.orig%
+ % info: stdout diff: test[/\\]1[/\\]stdout\.diff%
+ % info: stdin: test[/\\]1[/\\]stdin%
EOE
}
-: out-doc-regex
+: file
:
{
- : match
+ : in-out
:
$c <<EOI;
- $* -o foo -o foo -o bar >>~/EOO/i
- /FO*/*
+ $* -o foo >>>out;
+ $* -i 1 <<<out >foo
+ EOI
+ $b
+
+ : append
+ :
+ $c <<EOI;
+ $* -o foo >>>out;
+ $* -e bar 2>>>&out;
+ $* -i 1 <<<out >>EOO
+ foo
bar
- /*
EOO
EOI
$b
- : match-empty
+ : merge
:
$c <<EOI;
- $* >>:~/EOO/i
- /.{0}
+ $* -o foo -e bar 2>&1 >>>out;
+ $* -e baz -o biz 1>&2 2>>>&out;
+ $* -i 1 <<<out >>EOO
+ foo
+ bar
+ baz
+ biz
EOO
EOI
$b
}
-# Builtins redirects.
-#
+: regex
+:
+{
+ : str
+ :
+ {
+ : match
+ :
+ $c <'$* -o foo >~/Foo?/i';
+ $b
+
+ : mismatch
+ :
+ $c <'$* -o fooo >~/Foo?/i';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? stdout doesn't match the regex%
+ % info: stdout: test[/\\]1[/\\]stdout%
+ % info: stdout regex: test[/\\]1[/\\]stdout\.regex%
+ EOE
+ }
+
+ : doc
+ :
+ {
+ : match
+ :
+ $c <<EOI;
+ $* -o foo -o foo -o bar >>~/EOO/i
+ /FO*/*
+ bar
+ /*
+ EOO
+ EOI
+ $b
+
+ : match-empty
+ :
+ $c <<EOI;
+ $* >>:~/EOO/i
+ /.{0}
+ EOO
+ EOI
+ $b
+ }
+}
+
# @@ That will probably become redundant when builtins and process obtain file
# descriptors uniformly.
#
diff --git a/tests/test/script/runner/status.test b/tests/test/script/runner/status.test
index f12cd58..0daa8c7 100644
--- a/tests/test/script/runner/status.test
+++ b/tests/test/script/runner/status.test
@@ -6,33 +6,37 @@
b += --no-column
-# Successfull tests.
-#
-: eq-true
+: eq
:
-$c <'$* == 0';
-$b
-
-: ne-true
-:
-$c <'$* -s 1 != 0';
-$b
-
-# Faulty tests.
-#
-: eq-false
-:
-$c <'$* -s 1 == 0';
-$b 2>>~%EOE% != 0
-%testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? exit status 1 != 0%
-EOE
-
-: ne-false
+{
+ : true
+ :
+ $c <'$* == 0';
+ $b
+
+ : false
+ :
+ $c <'$* -s 1 == 0';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? exit status 1 != 0%
+ EOE
+}
+
+: ne
:
-$c <'$* -s 1 != 1';
-$b 2>>~%EOE% != 0
-%testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? exit status 1 == 1%
-EOE
+{
+ : true
+ :
+ $c <'$* -s 1 != 0';
+ $b
+
+ : false
+ :
+ $c <'$* -s 1 != 1';
+ $b 2>>~%EOE% != 0
+ %testscript:1: error: \.\.[/\\]\.\.[/\\]\.\.[/\\]\.\.[/\\]driver(\.exe)? exit status 1 == 1%
+ EOE
+}
: error
: