aboutsummaryrefslogtreecommitdiff
path: root/tests/test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-02-09 23:16:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-02-10 10:42:46 +0300
commit4219d7f14e5c63e251f83fd0fff32b707e412cd6 (patch)
treee1d2c4cd652d560d5a62e8ed881fa1b879b67c4f /tests/test
parent2c1aff8bf09a50189c3d0b2ff86ab057ca009749 (diff)
Fix save_regex()
Diffstat (limited to 'tests/test')
-rw-r--r--tests/test/script/runner/redirect.test21
-rw-r--r--tests/test/script/runner/regex.test58
2 files changed, 49 insertions, 30 deletions
diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test
index 3cd6c69..b316011 100644
--- a/tests/test/script/runner/redirect.test
+++ b/tests/test/script/runner/redirect.test
@@ -39,8 +39,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
: inout-fail
:
- $c <'$* -i 1 <foo >bar';
- $b 2>>/~%EOE%d != 0
+ $c <'$* -i 1 <foo >bar' && $b 2>>/~%EOE%d != 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
@@ -61,8 +60,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
: no-newline-fail1
:
- $c <'$* -i 1 <:"foo" >"foo"';
- $b 2>>~/EOE/ != 0
+ $c <'$* -i 1 <:"foo" >"foo"' && $b 2>>~/EOE/ != 0
/testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
/.{7}
-foo
@@ -72,8 +70,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
: no-newline-fail2
:
- $c <'$* -i 1 <"foo" >:"foo"';
- $b 2>>~/EOE/ != 0
+ $c <'$* -i 1 <"foo" >:"foo"' && $b 2>>~/EOE/ != 0
/testscript:1: error: .+driver(\.exe)? stdout doesn't match the expected output/
/.{7}
-foo
@@ -107,13 +104,11 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
{
: match
:
- $c <'$* -o foo >~/Foo?/i';
- $b
+ $c <'$* -o foo >~/Foo?/i' && $b
: mismatch
:
- $c <'$* -o fooo >~/Foo?/i';
- $b 2>>/~%EOE%d != 0
+ $c <'$* -o fooo >~/Foo?/i' && $b 2>>/~%EOE%d != 0
%testscript:1: error: ../../../../../driver(.exe)? stdout doesn't match the regex%
info: stdout: test/1/stdout
info: stdout regex: test/1/stdout.regex
@@ -127,8 +122,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
{
: newline
:
- $c <"\$* -i 1 <'foo' >/~%bar/%";
- $b 2>>/~%EOE%d != 0;
+ $c <"\$* -i 1 <'foo' >/~%bar/%" && $b 2>>/~%EOE%d != 0;
%testscript:1: error: ../../../../../../driver(.exe)? stdout doesn't match the regex%
info: stdout: test/1/stdout
info: stdout regex: test/1/stdout.regex
@@ -138,8 +132,7 @@ psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex.
: no-newline
:
- $c <"\$* -i 1 <'foo' >:/~%bar/%";
- $b 2>>/~%EOE%d != 0;
+ $c <"\$* -i 1 <'foo' >:/~%bar/%" && $b 2>>/~%EOE%d != 0;
%testscript:1: error: ../../../../../../driver(.exe)? stdout doesn't match the regex%
info: stdout: test/1/stdout
info: stdout regex: test/1/stdout.regex
diff --git a/tests/test/script/runner/regex.test b/tests/test/script/runner/regex.test
index 413069c..c45c3a5 100644
--- a/tests/test/script/runner/regex.test
+++ b/tests/test/script/runner/regex.test
@@ -32,11 +32,19 @@
: Note that old versions of libc++ (for example 1.1) do not detect some
: regex errors. For example '*' is parsed successfully.
:
- $c <'$* -o foo >~/foo[/';
- $b 2>>~/EOE/ != 0
- /testscript:1:13: error: invalid stdout regex redirect.*/
+ $c <'cat <foo >~/foo[/' && $b 2>>~/EOE/ != 0
+ /testscript:1:12: error: invalid stdout regex redirect.*/
info: regex: '/foo[/'
EOE
+
+ : no-match
+ :
+ $c <'cat <foo >~/bar/' && $b 2>>/EOE != 0
+ testscript:1:1: error: cat stdout doesn't match the regex
+ info: stdout: test/1/stdout
+ info: stdout regex: test/1/stdout.regex
+ info: stdin: test/1/stdin
+ EOE
}
: doc
@@ -114,36 +122,54 @@
: invalid-syntax-char
:
$c <<EOI && $b 2>>EOE != 0
- $* -o foo >>~/EOO/
- /x
- EOO
+ cat <foo >>~/EOO/
+ /x
+ EOO
EOI
- testscript:2:3: error: invalid syntax character 'x' in stdout regex redirect
+ testscript:2:1: error: invalid syntax character 'x' in stdout regex redirect
info: regex line: '/x'
EOE
: invalid-char-regex
:
$c <<EOI && $b 2>>~/EOE/ != 0
- $* -o foo >>~/EOO/
- /foo[/
- EOO
+ cat <foo >>~/EOO/
+ /foo[/
+ EOO
EOI
- /testscript:2:3: error: invalid char-regex in stdout regex redirect.*/
+ /testscript:2:1: error: invalid char-regex in stdout regex redirect.*/
info: regex line: '/foo[/'
EOE
: invalid-line-regex
:
$c <<EOI && $b 2>>/~%EOE% != 0
- $* -o foo >>~/EOO/
- a
- /{
- EOO
+ cat <foo >>~/EOO/
+ a
+ /{
+ EOO
EOI
- %testscript:4:3: error: invalid stdout regex redirect.*%
+ %testscript:4:1: error: invalid stdout regex redirect.*%
info: stdout regex: test/1/stdout.regex
EOE
+
+ : no-match
+ :
+ {
+ : leading-blank
+ :
+ $c <<EOI && $b 2>>/EOE != 0
+ cat <foo >>~/EOO/
+
+ foo
+ EOO
+ EOI
+ testscript:1:1: error: cat stdout doesn't match the regex
+ info: stdout: test/1/stdout
+ info: stdout regex: test/1/stdout.regex
+ info: stdin: test/1/stdin
+ EOE
+ }
}
}