diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-06 18:46:58 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-09 21:44:23 +0300 |
commit | c55240fb05151cae046c75a793c164d72c988db2 (patch) | |
tree | 35cbba195e0fcc581944b7b098a3ea145741cf94 /unit-tests/test/script/lexer/command-expansion.test | |
parent | 9e2b4fd3bbc0c61bf6c84540c52869ec7d830718 (diff) |
Tests cleanup (take 2)
Diffstat (limited to 'unit-tests/test/script/lexer/command-expansion.test')
-rw-r--r-- | unit-tests/test/script/lexer/command-expansion.test | 360 |
1 files changed, 228 insertions, 132 deletions
diff --git a/unit-tests/test/script/lexer/command-expansion.test b/unit-tests/test/script/lexer/command-expansion.test index f113846..faae29d 100644 --- a/unit-tests/test/script/lexer/command-expansion.test +++ b/unit-tests/test/script/lexer/command-expansion.test @@ -1,134 +1,230 @@ +# file : unit-tests/test/script/lexer/command-expansion.test +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + test.arguments = command-expansion -$* <:"0<+" >>EOO # in-pass-redirect -'0' -<+ -EOO - -$* <:"0 <+" >>EOO # arg-in-pass-redirect -'0 ' -<+ -EOO - -$* <:"1>+" >>EOO # out-pass-redirect -'1' ->+ -EOO - -$* <:"1 >+" >>EOO # arg-out-pass-redirect -'1 ' ->+ -EOO - -$* <:"0<-" >>EOO # in-null-redirect -'0' -<- -EOO - -$* <:"0 <-" >>EOO # arg-in-null-redirect -'0 ' -<- -EOO - -$* <:"1>-" >>EOO # out-null-redirect -'1' ->- -EOO - -$* <:"1 >-" >>EOO # arg-out-null-redirect -'1 ' ->- -EOO - -$* <:"1>&2" >>EOO # merge-redirect -'1' ->& -'2' -EOO - -$* <:"1 >&2" >>EOO # arg-merge-redirect -'1 ' ->& -'2' -EOO - -$* <:"0<a b" >>EOO # in-str-redirect -'0' -< -'a b' -EOO - -$* <:"1>a b" >>EOO # out-str-redirect -'1' -> -'a b' -EOO - -$* <:"0<:a b" >>EOO # in-str-nn-redirect -'0' -<: -'a b' -EOO - -$* <:"1>:a b" >>EOO # out-str-nn-redirect -'1' ->: -'a b' -EOO - -$* <:"0<<E O I" >>EOO # in-doc-redirect -'0' -<< -'E O I' -EOO - -$* <:"1>>E O O" >>EOO # out-doc-redirect -'1' ->> -'E O O' -EOO - -$* <:"0<<:E O I" >>EOO # in-doc-nn-redirect -'0' -<<: -'E O I' -EOO - -$* <:"1>>:E O O" >>EOO # out-doc-nn-redirect -'1' ->>: -'E O O' -EOO - -$* <:"0<<<a b" >>EOO # in-file-redirect -'0' -<<< -'a b' -EOO - -$* <:"1>>>a b" >>EOO # out-file-redirect -'1' ->>> -'a b' -EOO - -$* <:"1>>>&a b" >>EOO # out-file-app-redirect -'1' ->>>& -'a b' -EOO - -$* <:"&file" >>EOO # cleanup-always -& -'file' -EOO - -$* <:"&?file" >>EOO # cleanup-maybe -&? -'file' -EOO - -$* <:"&!file" >>EOO # cleanup-never -&! -'file' -EOO +: pass-redirect +: +{ + : in + : + $* <:"0<+" >>EOO + '0' + <+ + EOO + + : arg-in + : + $* <:"0 <+" >>EOO + '0 ' + <+ + EOO + + : out + : + $* <:"1>+" >>EOO + '1' + >+ + EOO + + : arg-out + : + $* <:"1 >+" >>EOO + '1 ' + >+ + EOO +} + +: null-redirect +: +{ + : in + : + $* <:"0<-" >>EOO + '0' + <- + EOO + + : arg-in + : + $* <:"0 <-" >>EOO + '0 ' + <- + EOO + + : out + : + $* <:"1>-" >>EOO + '1' + >- + EOO + + : arg-out + : + $* <:"1 >-" >>EOO + '1 ' + >- + EOO +} + +: merge-redirect +: +{ + : out + : + $* <:"1>&2" >>EOO + '1' + >& + '2' + EOO + + : arg-out + : + $* <:"1 >&2" >>EOO + '1 ' + >& + '2' + EOO +} + +: str-redirect +: +{ + : in + : + { + : newline + : + $* <:"0<a b" >>EOO + '0' + < + 'a b' + EOO + + : no-newline + : + $* <:"0<:a b" >>EOO + '0' + <: + 'a b' + EOO + } + + : out + : + { + : newline + : + $* <:"1>a b" >>EOO + '1' + > + 'a b' + EOO + + : no-newline + : + $* <:"1>:a b" >>EOO + '1' + >: + 'a b' + EOO + } +} + +: doc-redirect +: +{ + : in + : + { + : newline + : + $* <:"0<<E O I" >>EOO + '0' + << + 'E O I' + EOO + + : no-newline + : + $* <:"0<<:E O I" >>EOO + '0' + <<: + 'E O I' + EOO + } + + : out + : + { + : newline + : + $* <:"1>>E O O" >>EOO + '1' + >> + 'E O O' + EOO + + : no-newline + : + $* <:"1>>:E O O" >>EOO + '1' + >>: + 'E O O' + EOO + } +} + +: file-redirect +: +{ + : in + : + $* <:"0<<<a b" >>EOO + '0' + <<< + 'a b' + EOO + + : out + : + $* <:"1>>>a b" >>EOO + '1' + >>> + 'a b' + EOO + + : out-app + : + $* <:"1>>>&a b" >>EOO + '1' + >>>& + 'a b' + EOO +} + +: cleanup +: +{ + : always + : + $* <:"&file" >>EOO + & + 'file' + EOO + + : maybe + : + $* <:"&?file" >>EOO + &? + 'file' + EOO + + : never + : + $* <:"&!file" >>EOO + &! + 'file' + EOO +} |