diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-20 20:25:59 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-24 14:53:00 +0300 |
commit | 28106f96de8ae5cdb3a0ee0e3a8a8185551e3b00 (patch) | |
tree | 8b912a7c9a2bd2ba1263695428d8343d022953a5 /unit-tests/test/script | |
parent | eeed734583c2f553e71ae0bd78a4b6e7e4d9cc2b (diff) |
Add support for comparison of test command output to a file
Diffstat (limited to 'unit-tests/test/script')
-rw-r--r-- | unit-tests/test/script/lexer/command-expansion.test | 24 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/command-line.test | 24 | ||||
-rw-r--r-- | unit-tests/test/script/parser/directive.test | 2 | ||||
-rw-r--r-- | unit-tests/test/script/parser/include.test | 12 | ||||
-rw-r--r-- | unit-tests/test/script/parser/redirect.test | 34 |
5 files changed, 58 insertions, 38 deletions
diff --git a/unit-tests/test/script/lexer/command-expansion.test b/unit-tests/test/script/lexer/command-expansion.test index faae29d..d405de6 100644 --- a/unit-tests/test/script/lexer/command-expansion.test +++ b/unit-tests/test/script/lexer/command-expansion.test @@ -9,30 +9,30 @@ test.arguments = command-expansion { : in : - $* <:"0<+" >>EOO + $* <:"0<|" >>EOO '0' - <+ + <| EOO : arg-in : - $* <:"0 <+" >>EOO + $* <:"0 <|" >>EOO '0 ' - <+ + <| EOO : out : - $* <:"1>+" >>EOO + $* <:"1>|" >>EOO '1' - >+ + >| EOO : arg-out : - $* <:"1 >+" >>EOO + $* <:"1 >|" >>EOO '1 ' - >+ + >| EOO } @@ -189,17 +189,17 @@ test.arguments = command-expansion : out : - $* <:"1>>>a b" >>EOO + $* <:"1>=a b" >>EOO '1' - >>> + >= 'a b' EOO : out-app : - $* <:"1>>>&a b" >>EOO + $* <:"1>+a b" >>EOO '1' - >>>& + >+ 'a b' EOO } diff --git a/unit-tests/test/script/lexer/command-line.test b/unit-tests/test/script/lexer/command-line.test index 8a73b3d..57fcfdf 100644 --- a/unit-tests/test/script/lexer/command-line.test +++ b/unit-tests/test/script/lexer/command-line.test @@ -64,11 +64,11 @@ test.arguments = command-line { : pass : - $* <"cmd <+ 1>+" >>EOO + $* <"cmd <| 1>|" >>EOO 'cmd' - <+ + <| '1' - >+ + >| <newline> EOO @@ -140,16 +140,28 @@ test.arguments = command-line <newline> EOO - : file + : file-cmp : - $* <"cmd <<<in >>>out 2>>>&err" >>EOO + $* <"cmd <<<in >>>out 2>>>err" >>EOO 'cmd' <<< 'in' >>> 'out' '2' - >>>& + >>> + 'err' + <newline> + EOO + + : file-write + : + $* <"cmd >=out 2>+err" >>EOO + 'cmd' + >= + 'out' + '2' + >+ 'err' <newline> EOO diff --git a/unit-tests/test/script/parser/directive.test b/unit-tests/test/script/parser/directive.test index d426d9c..d735fb4 100644 --- a/unit-tests/test/script/parser/directive.test +++ b/unit-tests/test/script/parser/directive.test @@ -46,7 +46,7 @@ EOI : var-expansion : -cat <<EOI >>>"foo-$(build.version).test"; +cat <<EOI >="foo-$(build.version).test"; cmd EOI $* <<EOI >>EOO diff --git a/unit-tests/test/script/parser/include.test b/unit-tests/test/script/parser/include.test index c810036..0559716 100644 --- a/unit-tests/test/script/parser/include.test +++ b/unit-tests/test/script/parser/include.test @@ -19,7 +19,7 @@ EOI : one : -cat <"cmd" >>>foo.test; +cat <"cmd" >=foo.test; $* <<EOI >>EOO .include foo.test EOI @@ -28,8 +28,8 @@ EOO : multiple : -cat <"cmd foo" >>>foo.test; -cat <"cmd bar" >>>bar.test; +cat <"cmd foo" >=foo.test; +cat <"cmd bar" >=bar.test; $* <<EOI >>EOO .include foo.test bar.test EOI @@ -39,7 +39,7 @@ EOO : once : -cat <"cmd" >>>foo.test; +cat <"cmd" >=foo.test; $* <<EOI >>EOO .include foo.test x @@ -56,7 +56,7 @@ EOO : group-id : -cat <<EOI >>>foo.test; +cat <<EOI >=foo.test; { x = b } @@ -73,7 +73,7 @@ EOO : test-id : -cat <<EOI >>>foo.test; +cat <<EOI >=foo.test; cmd EOI $* -s -i <<EOI >>EOO diff --git a/unit-tests/test/script/parser/redirect.test b/unit-tests/test/script/parser/redirect.test index 3db684a..b1c1209 100644 --- a/unit-tests/test/script/parser/redirect.test +++ b/unit-tests/test/script/parser/redirect.test @@ -85,20 +85,28 @@ : file : { - : not-quote + : cmp : $* <<EOI >>EOO - cmd 0<<<a 1>>>b 2>>>&c + cmd 0<<<a 1>>>b 2>>>c EOI - cmd <<<a >>>b 2>>>&c + cmd <<<a >>>b 2>>>c + EOO + + : write + : + $* <<EOI >>EOO + cmd 1>=b 2>+c + EOI + cmd >=b 2>+c EOO : quote : $* <<EOI >>EOO - cmd 0<<<"a f" 1>>>"b f" 2>>>&"c f" + cmd 0<<<"a f" 1>="b f" 2>+"c f" EOI - cmd <<<'a f' >>>'b f' 2>>>&'c f' + cmd <<<'a f' >='b f' 2>+'c f' EOO : in @@ -127,17 +135,17 @@ : missed : $* <<EOI 2>>EOE !=0 - cmd >>> + cmd >= EOI - testscript:1:8: error: missing stdout file + testscript:1:7: error: missing stdout file EOE : empty : $* <<EOI 2>>EOE !=0 - cmd >>>"" + cmd >="" EOI - testscript:1:8: error: empty stdout redirect path + testscript:1:7: error: empty stdout redirect path EOE } @@ -147,17 +155,17 @@ : missed : $* <<EOI 2>>EOE !=0 - cmd 2>>> + cmd 2>= EOI - testscript:1:9: error: missing stderr file + testscript:1:8: error: missing stderr file EOE : empty : $* <<EOI 2>>EOE !=0 - cmd 2>>>"" + cmd 2>="" EOI - testscript:1:9: error: empty stderr redirect path + testscript:1:8: error: empty stderr redirect path EOE } } |