aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/test/script/parser/description.test
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/test/script/parser/description.test')
-rw-r--r--unit-tests/test/script/parser/description.test720
1 files changed, 410 insertions, 310 deletions
diff --git a/unit-tests/test/script/parser/description.test b/unit-tests/test/script/parser/description.test
index 16ba287..3e2bb7f 100644
--- a/unit-tests/test/script/parser/description.test
+++ b/unit-tests/test/script/parser/description.test
@@ -1,114 +1,414 @@
-$* <<EOI >>EOO # id
-: foo
-cmd
-EOI
-: id:foo
-cmd
-EOO
+# file : unit-tests/test/script/parser/description.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
-$* <<EOI >>EOO # trail-id
-cmd : foo
-EOI
-: id:foo
-cmd
-EOO
+: id
+:
+{
+ : lead
+ :
+ $* <<EOI >>EOO
+ : foo
+ cmd
+ EOI
+ : id:foo
+ cmd
+ EOO
-$* <<EOI >>EOO # summary
-: foo bar
-cmd
-EOI
-: sm:foo bar
-cmd
-EOO
+ : trail
+ :
+ $* <<EOI >>EOO
+ cmd : foo
+ EOI
+ : id:foo
+ cmd
+ EOO
+
+ : dup
+ : Id uniqueness
+ :
+ {
+ : test
+ :
+ {
+ : test
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ cmd
+ : foo
+ cmd
+ EOI
+ testscript:3:1: error: duplicate id foo
+ testscript:1:1: info: previously used here
+ EOE
+
+ : group
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ cmd
+ : foo
+ {
+ cmd
+ cmd
+ }
+ EOI
+ testscript:3:1: error: duplicate id foo
+ testscript:1:1: info: previously used here
+ EOE
+
+ : derived
+ :
+ $* <<EOI 2>>EOE != 0
+ : 3
+ cmd
+ cmd
+ EOI
+ testscript:3:1: error: duplicate id 3
+ testscript:1:1: info: previously used here
+ EOE
+ }
-$* <<EOI >>EOO # trail-summary
-cmd: foo bar
-EOI
-: sm:foo bar
-cmd
-EOO
+ : group
+ :
+ {
+ : test
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ {
+ cmd
+ cmd
+ }
+ : foo
+ cmd
+ EOI
+ testscript:6:1: error: duplicate id foo
+ testscript:1:1: info: previously used here
+ EOE
+
+ : group
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ {
+ cmd
+ cmd
+ }
+ : foo
+ {
+ cmd
+ cmd
+ }
+ EOI
+ testscript:6:1: error: duplicate id foo
+ testscript:1:1: info: previously used here
+ EOE
+
+ : derived
+ :
+ $* <<EOI 2>>EOE != 0
+ : 3
+ cmd
+ {
+ cmd
+ cmd
+ }
+ EOI
+ testscript:3:1: error: duplicate id 3
+ testscript:1:1: info: previously used here
+ EOE
+ }
+ }
+}
-$* <<EOI >>EOO # id-summary
-: foo-bar
-: foo bar
-cmd
-EOI
-: id:foo-bar
-: sm:foo bar
-cmd
-EOO
+: summary
+{
+ : lead
+ :
+ $* <<EOI >>EOO
+ : foo bar
+ cmd
+ EOI
+ : sm:foo bar
+ cmd
+ EOO
-# Initially assumed summary.
-#
-$* <<EOI >>EOO # details-summary
-: foo bar
-: bar baz
-cmd
-EOI
-: foo bar
-: bar baz
-cmd
-EOO
+ : trail
+ :
+ $* <<EOI >>EOO
+ cmd: foo bar
+ EOI
+ : sm:foo bar
+ cmd
+ EOO
-# Initially assumed id and summary.
-#
-$* <<EOI >>EOO # details-id-summary
-: foo-bar
-: bar baz
-: baz fox
-cmd
-EOI
-: foo-bar
-: bar baz
-: baz fox
-cmd
-EOO
+ : id
+ :
+ $* <<EOI >>EOO
+ : foo-bar
+ : foo bar
+ cmd
+ EOI
+ : id:foo-bar
+ : sm:foo bar
+ cmd
+ EOO
+}
-$* <<EOI >>EOO # id-details
-: foo-bar
+: details
+{
+ : id
+ :
+ $* <<EOI >>EOO
+ : foo-bar
+ :
+ : foo bar
+ : bar baz
+ cmd
+ EOI
+ : id:foo-bar
+ :
+ : foo bar
+ : bar baz
+ cmd
+ EOO
+
+ : summary
+ :
+ {
+ : only
+ :
+ $* <<EOI >>EOO
+ : foo bar
+ :
+ : foo bar
+ : bar baz
+ cmd
+ EOI
+ : sm:foo bar
+ :
+ : foo bar
+ : bar baz
+ cmd
+ EOO
+
+ : assumed
+ :
+ $* <<EOI >>EOO
+ : foo bar
+ : bar baz
+ cmd
+ EOI
+ : foo bar
+ : bar baz
+ cmd
+ EOO
+
+ : id
+ :
+ $* <<EOI >>EOO
+ : foo-bar
+ : foo bar
+ :
+ : foo bar
+ : bar baz
+ cmd
+ EOI
+ : id:foo-bar
+ : sm:foo bar
+ :
+ : foo bar
+ : bar baz
+ cmd
+ EOO
+
+ : id-assumed
+ :
+ $* <<EOI >>EOO
+ : foo-bar
+ : bar baz
+ : baz fox
+ cmd
+ EOI
+ : foo-bar
+ : bar baz
+ : baz fox
+ cmd
+ EOO
+ }
+}
+
+: legal
:
-: foo bar
-: bar baz
-cmd
-EOI
-: id:foo-bar
+: Legal places for description.
:
-: foo bar
-: bar baz
-cmd
-EOO
+{
+ : var
+ :
+ $* <<EOI >>EOO
+ : foo bar
+ x = y;
+ cmd $x
+ EOI
+ : sm:foo bar
+ cmd y
+ EOO
+}
-$* <<EOI >>EOO # summary-details
-: foo bar
+: illegal
:
-: foo bar
-: bar baz
-cmd
-EOI
-: sm:foo bar
+: Illegal places for description.
:
-: foo bar
-: bar baz
-cmd
-EOO
+{
+ : eof
+ :
+ $* <": foo" 2>>EOE != 0
+ testscript:2:1: error: description before <end of file>
+ EOE
+
+ : rcbrace
+ :
+ $* <<EOI 2>>EOE != 0
+ {
+ cmd
+ : foo
+ }
+ EOI
+ testscript:4:1: error: description before '}'
+ EOE
-$* <<EOI >>EOO # id-summary-details
-: foo-bar
-: foo bar
+ : setup
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ +cmd
+ EOI
+ testscript:2:1: error: description before setup command
+ EOE
+
+ : tdown
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ -cmd
+ EOI
+ testscript:2:1: error: description before teardown command
+ EOE
+
+ : var
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ x = y
+ EOI
+ testscript:2:1: error: description before setup/teardown variable
+ EOE
+
+ : var-if
+ :
+ $* <<EOI 2>>EOE != 0
+ : foo
+ if true
+ x = y
+ end
+ EOI
+ testscript:2:1: error: description before/after setup/teardown variable-if
+ EOE
+
+ : var-if-after
+ :
+ $* <<EOI 2>>EOE != 0
+ if true
+ x = y
+ end : foo
+ EOI
+ testscript:1:1: error: description before/after setup/teardown variable-if
+ EOE
+
+ : test
+ :
+ $* <<EOI 2>>EOE != 0
+ cmd1;
+ : foo
+ cmd2
+ EOI
+ testscript:2:1: error: description inside test
+ EOE
+}
+
+: test-scope
:
-: foo bar
-: bar baz
-cmd
-EOI
-: id:foo-bar
-: sm:foo bar
+: Interaction with test scope merging.
:
-: foo bar
-: bar baz
-cmd
-EOO
+{
+ : both
+ :
+ : No merge since both have description.
+ :
+ $* -s -i <<EOI >>EOO
+ : foo
+ {
+ : bar
+ cmd
+ }
+ EOI
+ {
+ : id:foo
+ { # foo
+ : id:bar
+ { # foo/bar
+ cmd
+ }
+ }
+ }
+ EOO
+
+ : test
+ :
+ : No merge since test has description.
+ :
+ $* -s -i <<EOI >>EOO
+ {
+ : foo-bar
+ : foo bar
+ cmd
+ }
+ EOI
+ {
+ { # 1
+ : id:foo-bar
+ : sm:foo bar
+ { # 1/foo-bar
+ cmd
+ }
+ }
+ }
+ EOO
-$* <<EOI >>EOO # blanks
+ : group
+ :
+ $* -s -i <<EOI >>EOO
+ : foo-bar
+ : foo bar
+ {
+ cmd
+ }
+ EOI
+ {
+ : id:foo-bar
+ : sm:foo bar
+ { # foo-bar
+ cmd
+ }
+ }
+ EOO
+}
+
+: blanks
+:
+$* <<EOI >>EOO
:
:
: foo bar
@@ -126,7 +426,9 @@ EOI
cmd
EOO
-$* <<EOI >>EOO # strip
+: strip
+:
+$* <<EOI >>EOO
: foo-bar
: bar baz
:
@@ -145,7 +447,9 @@ EOI
cmd
EOO
-$* <<EOI >>EOO # trail-compound
+: trail-compound
+:
+$* <<EOI >>EOO
cmd1;
cmd2: foo
EOI
@@ -154,7 +458,9 @@ cmd1
cmd2
EOO
-$* <<EOI 2>>EOE != 0 # empty
+: empty
+:
+$* <<EOI 2>>EOE != 0
:
:
cmd
@@ -162,225 +468,19 @@ EOI
testscript:1:1: error: empty description
EOE
-$* <<EOI 2>>EOE != 0 # trail-empty
+: trail-empty
+:
+$* <<EOI 2>>EOE != 0
cmd:
EOI
testscript:1:4: error: empty description
EOE
-$* <<EOI 2>>EOE != 0 # both
+: both
+:
+$* <<EOI 2>>EOE != 0
: foo
cmd : bar
EOI
testscript:2:1: error: both leading and trailing descriptions
EOE
-
-# Legal places for a description.
-#
-$* <<EOI >>EOO # legal-var
-: foo bar
-x = y;
-cmd $x
-EOI
-: sm:foo bar
-cmd y
-EOO
-
-# Illegal places for a description.
-#
-$* <": foo" 2>>EOE != 0 # illegal-eof
-testscript:2:1: error: description before <end of file>
-EOE
-
-$* <<EOI 2>>EOE != 0 # illegal-rcbrace
-{
- cmd
- : foo
-}
-EOI
-testscript:4:1: error: description before '}'
-EOE
-
-$* <<EOI 2>>EOE != 0 # illegal-setup
-: foo
-+cmd
-EOI
-testscript:2:1: error: description before setup command
-EOE
-
-$* <<EOI 2>>EOE != 0 # illegal-tdown
-: foo
--cmd
-EOI
-testscript:2:1: error: description before teardown command
-EOE
-
-$* <<EOI 2>>EOE != 0 # illegal-var
-: foo
-x = y
-EOI
-testscript:2:1: error: description before setup/teardown variable
-EOE
-
-$* <<EOI 2>>EOE != 0 # illegal-var-if
-: foo
-if true
- x = y
-end
-EOI
-testscript:2:1: error: description before/after setup/teardown variable-if
-EOE
-
-$* <<EOI 2>>EOE != 0 # illegal-var-if-after
-if true
- x = y
-end : foo
-EOI
-testscript:1:1: error: description before/after setup/teardown variable-if
-EOE
-
-$* <<EOI 2>>EOE != 0 # illegal-test
-cmd1;
-: foo
-cmd2
-EOI
-testscript:2:1: error: description inside test
-EOE
-
-# Id uniqueness.
-#
-$* <<EOI 2>>EOE != 0 # id-dup-test-test
-: foo
-cmd
-: foo
-cmd
-EOI
-testscript:3:1: error: duplicate id foo
- testscript:1:1: info: previously used here
-EOE
-
-$* <<EOI 2>>EOE != 0 # id-dup-test-group
-: foo
-cmd
-: foo
-{
- cmd
- cmd
-}
-EOI
-testscript:3:1: error: duplicate id foo
- testscript:1:1: info: previously used here
-EOE
-
-$* <<EOI 2>>EOE != 0 # id-dup-group-test
-: foo
-{
- cmd
- cmd
-}
-: foo
-cmd
-EOI
-testscript:6:1: error: duplicate id foo
- testscript:1:1: info: previously used here
-EOE
-
-$* <<EOI 2>>EOE != 0 # id-dup-group-group
-: foo
-{
- cmd
- cmd
-}
-: foo
-{
- cmd
- cmd
-}
-EOI
-testscript:6:1: error: duplicate id foo
- testscript:1:1: info: previously used here
-EOE
-
-$* <<EOI 2>>EOE != 0 # id-dup-group-derived
-: 3
-cmd
-{
- cmd
- cmd
-}
-EOI
-testscript:3:1: error: duplicate id 3
- testscript:1:1: info: previously used here
-EOE
-
-$* <<EOI 2>>EOE != 0 # id-dup-test-derived
-: 3
-cmd
-cmd
-EOI
-testscript:3:1: error: duplicate id 3
- testscript:1:1: info: previously used here
-EOE
-
-# Interaction with test scope merging.
-#
-
-: test-scope-both
-:
-: No merge since both have description.
-:
-$* -s -i <<EOI >>EOO
-: foo
-{
- : bar
- cmd
-}
-EOI
-{
- : id:foo
- { # foo
- : id:bar
- { # foo/bar
- cmd
- }
- }
-}
-EOO
-
-: test-scope-test
-:
-: No merge since test has description.
-:
-$* -s -i <<EOI >>EOO #
-{
- : foo-bar
- : foo bar
- cmd
-}
-EOI
-{
- { # 1
- : id:foo-bar
- : sm:foo bar
- { # 1/foo-bar
- cmd
- }
- }
-}
-EOO
-
-$* -s -i <<EOI >>EOO # test-scope-group
-: foo-bar
-: foo bar
-{
- cmd
-}
-EOI
-{
- : id:foo-bar
- : sm:foo bar
- { # foo-bar
- cmd
- }
-}
-EOO