aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/test/script/lexer/command-line.test
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/test/script/lexer/command-line.test')
-rw-r--r--unit-tests/test/script/lexer/command-line.test311
1 files changed, 182 insertions, 129 deletions
diff --git a/unit-tests/test/script/lexer/command-line.test b/unit-tests/test/script/lexer/command-line.test
index 0040cfe..8a73b3d 100644
--- a/unit-tests/test/script/lexer/command-line.test
+++ b/unit-tests/test/script/lexer/command-line.test
@@ -1,134 +1,187 @@
+# file : unit-tests/test/script/lexer/command-line.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
test.arguments = command-line
-$* <"cmd;" >>EOO # semi
-'cmd'
-;
-<newline>
-EOO
-
-$* <"cmd ;" >>EOO # semi-separated
-'cmd'
-;
-<newline>
-EOO
-
-$* <";" >>EOO # semi-only
-;
-<newline>
-EOO
-
-$* <"cmd: dsc" >>EOO # colon
-'cmd'
+: semi
+{
+ : immediate
+ :
+ $* <"cmd;" >>EOO
+ 'cmd'
+ ;
+ <newline>
+ EOO
+
+ : separated
+ :
+ $* <"cmd ;" >>EOO
+ 'cmd'
+ ;
+ <newline>
+ EOO
+
+ : only
+ :
+ $* <";" >>EOO
+ ;
+ <newline>
+ EOO
+}
+
+: colon
:
-'dsc'
-<newline>
-EOO
-
-$* <"cmd :dsc" >>EOO # colon-separated
-'cmd'
+{
+ : immediate
+ :
+ $* <"cmd: dsc" >>EOO
+ 'cmd'
+ :
+ 'dsc'
+ <newline>
+ EOO
+
+ : separated
+ :
+ $* <"cmd :dsc" >>EOO
+ 'cmd'
+ :
+ 'dsc'
+ <newline>
+ EOO
+
+ : only
+ :
+ $* <":" >>EOO
+ :
+ <newline>
+ EOO
+}
+
+: redirect
:
-'dsc'
-<newline>
-EOO
-
-$* <":" >>EOO # colon-only
+{
+ : pass
+ :
+ $* <"cmd <+ 1>+" >>EOO
+ 'cmd'
+ <+
+ '1'
+ >+
+ <newline>
+ EOO
+
+ : null
+ :
+ $* <"cmd <- 1>-" >>EOO
+ 'cmd'
+ <-
+ '1'
+ >-
+ <newline>
+ EOO
+
+ : merge
+ :
+ $* <"cmd 1>&2" >>EOO
+ 'cmd'
+ '1'
+ >&
+ '2'
+ <newline>
+ EOO
+
+ : str
+ :
+ $* <"cmd <a 1>b" >>EOO
+ 'cmd'
+ <
+ 'a'
+ '1'
+ >
+ 'b'
+ <newline>
+ EOO
+
+ : str-nn
+ :
+ $* <"cmd <:a 1>:b" >>EOO
+ 'cmd'
+ <:
+ 'a'
+ '1'
+ >:
+ 'b'
+ <newline>
+ EOO
+
+ : doc
+ :
+ $* <"cmd <<EOI 1>>EOO" >>EOO
+ 'cmd'
+ <<
+ 'EOI'
+ '1'
+ >>
+ 'EOO'
+ <newline>
+ EOO
+
+ : doc-nn
+ :
+ $* <"cmd <<:EOI 1>>:EOO" >>EOO
+ 'cmd'
+ <<:
+ 'EOI'
+ '1'
+ >>:
+ 'EOO'
+ <newline>
+ EOO
+
+ : file
+ :
+ $* <"cmd <<<in >>>out 2>>>&err" >>EOO
+ 'cmd'
+ <<<
+ 'in'
+ >>>
+ 'out'
+ '2'
+ >>>&
+ 'err'
+ <newline>
+ EOO
+}
+
+: cleanup
:
-<newline>
-EOO
-
-$* <"cmd <+ 1>+" >>EOO # pass-redirect
-'cmd'
-<+
-'1'
->+
-<newline>
-EOO
-
-$* <"cmd <- 1>-" >>EOO # null-redirect
-'cmd'
-<-
-'1'
->-
-<newline>
-EOO
-
-$* <"cmd 1>&2" >>EOO # merge-redirect
-'cmd'
-'1'
->&
-'2'
-<newline>
-EOO
-
-$* <"cmd <a 1>b" >>EOO # str-redirect
-'cmd'
-<
-'a'
-'1'
->
-'b'
-<newline>
-EOO
-
-$* <"cmd <:a 1>:b" >>EOO # str-nn-redirect
-'cmd'
-<:
-'a'
-'1'
->:
-'b'
-<newline>
-EOO
-
-$* <"cmd <<EOI 1>>EOO" >>EOO # doc-redirect
-'cmd'
-<<
-'EOI'
-'1'
->>
-'EOO'
-<newline>
-EOO
-
-$* <"cmd <<:EOI 1>>:EOO" >>EOO # doc-nn-redirect
-'cmd'
-<<:
-'EOI'
-'1'
->>:
-'EOO'
-<newline>
-EOO
-
-$* <"cmd <<<in >>>out 2>>>&err" >>EOO # file-redirect
-'cmd'
-<<<
-'in'
->>>
-'out'
-'2'
->>>&
-'err'
-<newline>
-EOO
-
-$* <"cmd &file" >>EOO # cleanup-always
-'cmd'
-&
-'file'
-<newline>
-EOO
-
-$* <"cmd &?file" >>EOO # cleanup-maybe
-'cmd'
-&?
-'file'
-<newline>
-EOO
-
-$* <"cmd &!file" >>EOO # cleanup-never
-'cmd'
-&!
-'file'
-<newline>
-EOO
+{
+ : always
+ :
+ $* <"cmd &file" >>EOO
+ 'cmd'
+ &
+ 'file'
+ <newline>
+ EOO
+
+ : maybe
+ :
+ $* <"cmd &?file" >>EOO
+ 'cmd'
+ &?
+ 'file'
+ <newline>
+ EOO
+
+ : never
+ :
+ $* <"cmd &!file" >>EOO
+ 'cmd'
+ &!
+ 'file'
+ <newline>
+ EOO
+}