diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-11 01:43:09 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-19 17:56:07 +0300 |
commit | a83f3866667bca073c4d4c5d80b4deb5ac05906c (patch) | |
tree | 479464203f6be4535c8f165a20d21322a88a2751 /tests/test/script/runner/redirect.test | |
parent | ba99b60aeb8ccdeffc777589b99728395cd28f95 (diff) |
Add support for portable path modifer and dot character escaping inversion
Diffstat (limited to 'tests/test/script/runner/redirect.test')
-rw-r--r-- | tests/test/script/runner/redirect.test | 684 |
1 files changed, 401 insertions, 283 deletions
diff --git a/tests/test/script/runner/redirect.test b/tests/test/script/runner/redirect.test index 72e49b2..e2d765c 100644 --- a/tests/test/script/runner/redirect.test +++ b/tests/test/script/runner/redirect.test @@ -6,6 +6,9 @@ b += --no-column +ps = ($cxx.target.class != 'windows' ? '/' : '\') # Path separator. +psr = ($cxx.target.class != 'windows' ? '/' : '\\') # Path separator in regex. + : null : { @@ -23,279 +26,440 @@ b += --no-column : str : { - : in + : literal : - $c <'$* -i 0 <foo'; - $b + { + : in + : + $c <'$* -i 0 <foo'; + $b - : out - : - $c <'$* -o foo >foo'; - $b + : out + : + $c <'$* -o foo >foo'; + $b - : err - : - $c <'$* -e foo 2>foo'; - $b + : err + : + $c <'$* -e foo 2>foo'; + $b - : inout - : - $c <'$* -i 1 <foo >foo'; - $b + : inout + : + $c <'$* -i 1 <foo >foo'; + $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 - - : inerr - : - $c <'$* -i 2 <foo 2>foo'; - $b + : inout-fail + : + $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 + info: stdout diff: test/1/stdout.diff + info: stdin: test/1/stdin + %--- \.*% + %\+\+\+ \.*% + %@@ \.*% + -bar + +foo + EOE - : inout-err - : - $c <'$* -i 1 -e bar <foo 1>foo 2>bar'; - $b + : inerr + : + $c <'$* -i 2 <foo 2>foo'; + $b - : empty - : - $c <'$* -o "" >""'; - $b + : inout-err + : + $c <'$* -i 1 -e bar <foo 1>foo 2>bar'; + $b - : no-newline - : - $c <'$* -i 1 <:"foo" >:"foo"'; - $b + : empty + : + $c <'$* -o "" >""'; + $b - : no-newline-empty - : - $c <'$* -i 1 <:"" >:""'; - $b + : no-newline + : + $c <'$* -i 1 <:"foo" >:"foo"'; + $b - : no-newline-fail1 + : no-newline-empty + : + $c <'$* -i 1 <:"" >:""'; + $b + + : 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 + + : 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 + + : merge + : + $c <<EOI; + $* -o foo -e bar 2>>EOE 1>&2 + foo + bar + EOE + EOI + $b + + : portable-path + : + { + : in + : + $c <"\$* -i 1 </'foo/' >'foo$ps'"; + $b + + : out + : + $c <"\$* -i 1 <'foo$ps' >/'foo/'"; + $b + + : err + : + $c <"\$* -i 2 <'foo$ps' 2>/'foo/'"; + $b + } + } + + : regex : - $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-fail2 + : Test regex matching. Note that tests that check regex parsing are located + : in regex.test testscript. : - $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 + { + : match + : + $c <'$* -o foo >~/Foo?/i'; + $b - : merge - : - $c <<EOI; - $* -o foo -e bar 2>>EOE 1>&2 - foo - bar - EOE - EOI - $b + : mismatch + : + $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 + EOE + + : portable-path-failure + : + : Note that we check not only build2 diagnostics being produced, but also + : the correctness of regex being saved to file (for troubleshooting). + : + { + : newline + : + $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 + info: stdin: test/1/stdin + EOE + cat test/1/stdout.regex >"%bar$psr%" + + : no-newline + : + $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 + info: stdin: test/1/stdin + EOE + cat test/1/stdout.regex >:"%bar$psr%" + } + } } : doc : { - : in + : literal : - $c <<EOI; - $* -i 0 <<EOO - foo - bar - EOO - EOI - $b + { + : in + : + $c <<EOI; + $* -i 0 <<EOO + foo + bar + EOO + EOI + $b - : out - : - $c <<EOI; - $* -o foo -o bar >>EOO - foo - bar - EOO - EOI - $b + : out + : + $c <<EOI; + $* -o foo -o bar >>EOO + foo + bar + EOO + EOI + $b - : err - : - $c <<EOI; - $* -e foo -e bar 2>>EOO - foo - bar - EOO - EOI - $b + : err + : + $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 + : 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 + : 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 + : empty + : + $c <<EOI; + $* -i 1 <<EOF >>EOO + EOF + EOO + EOI + $b - : extra-newline - : - $c <<EOI; - $* -i 1 <<EOF >>EOO + : extra-newline + : + $c <<EOI; + $* -i 1 <<EOF >>EOO - EOF + EOF - EOO - EOI - $b + EOO + EOI + $b - : no-newline - : - $c <<EOI; - $* -i 1 <<:EOF >>:EOO - foo - EOF - foo - 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-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-extra-newline - : - $c <<EOI; - $* -i 1 <<:EOF >>:EOO + : 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 - EOF + : no-newline-empty + : + $c <<EOI; + $* -i 1 <<:EOF >>:EOO + EOF + EOO + EOI + $b - EOO - EOI - $b + : no-newline-extra-newline + : + $c <<EOI; + $* -i 1 <<:EOF >>:EOO - : merge - : - $c <<EOI; - $* -i 1 <<EOF -e baz >>EOO 2>&1 - foo - bar - EOF - foo - bar - baz - EOO - EOI - $b + EOF + + EOO + EOI + $b + + : merge + : + $c <<EOI; + $* -i 1 <<EOF -e baz >>EOO 2>&1 + foo + bar + EOF + foo + bar + baz + EOO + EOI + $b - : large-diff + : large-diff + : + : Make sure that the large (>4KB) expected/real output difference is not + : printed as a part of the 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%d != 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 + + : portable-path + : + { + : in + : + $c <<"EOI"; + \$* -i 1 <</EOF >'foo$ps' + foo/ + EOF + EOI + $b + + : out + : + $c <<"EOI"; + \$* -i 1 <'foo$ps' >>/EOO + foo/ + EOO + EOI + $b + + : err + : + $c <<"EOI"; + \$* -i 2 <'foo$ps' 2>>/EOE + foo/ + EOE + EOI + $b + } + } + + : regex : - : Make sure that the large (>4KB) expected/real output difference is not - : printed as a part of the diagnostics. + : Test regex matching. Note that tests that check regex parsing are located + : in regex.test testscript. : - $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 + { + : match + : + $c <<EOI; + $* -o foo -o foo -o bar >>~/EOO/i + /FO*/* + bar + /* + EOO + EOI + $b + + : match-empty + : + $c <<EOI; + $* >>:~/EOO/ + /.{0} + EOO + EOI + $b + + : mismatch + : + $c <<EOI; + $* -o foo >>~/EOO/ + bar + EOO + EOI + $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 + EOE + + : mismatch-icase + : + $c <<EOI; + $* -o foo >>~/EOO/i + bar + EOO + EOI + $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~i + EOE + } } : file @@ -336,52 +500,6 @@ b += --no-column $b } -: 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. # |