diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-28 10:10:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:36 +0200 |
commit | cd40097447ff2400cb420ec973c16dadd26e6cda (patch) | |
tree | bcd1c902d487e7a60ffffd5b02b7c608829fbc57 /unit-tests/test/script/parser/description.test | |
parent | e61874e76052d3600d6f10807248f92935f3dd61 (diff) |
Implement description support in testscript
Diffstat (limited to 'unit-tests/test/script/parser/description.test')
-rw-r--r-- | unit-tests/test/script/parser/description.test | 332 |
1 files changed, 332 insertions, 0 deletions
diff --git a/unit-tests/test/script/parser/description.test b/unit-tests/test/script/parser/description.test new file mode 100644 index 0000000..881cb5b --- /dev/null +++ b/unit-tests/test/script/parser/description.test @@ -0,0 +1,332 @@ +$* <<EOI >>EOO # id +: foo +cmd +EOI +: id:foo +cmd +EOO + +$* <<EOI >>EOO # summary +: foo bar +cmd +EOI +: sm:foo bar +cmd +EOO + +$* <<EOI >>EOO # id-summary +: foo-bar +: foo bar +cmd +EOI +: id:foo-bar +: sm:foo bar +cmd +EOO + +# Initially assumed summary. +# +$* <<EOI >>EOO # details-summary +: foo bar +: bar baz +cmd +EOI +: foo bar +: bar baz +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 + +$* <<EOI >>EOO # id-details +: foo-bar +: +: foo bar +: bar baz +cmd +EOI +: id:foo-bar +: +: foo bar +: bar baz +cmd +EOO + +$* <<EOI >>EOO # summary-details +: foo bar +: +: foo bar +: bar baz +cmd +EOI +: sm:foo bar +: +: foo bar +: bar baz +cmd +EOO + +$* <<EOI >>EOO # id-summary-details +: foo-bar +: foo bar +: +: foo bar +: bar baz +cmd +EOI +: id:foo-bar +: sm:foo bar +: +: foo bar +: bar baz +cmd +EOO + +$* <<EOI >>EOO # blanks +: +: +: foo bar +: bar baz +: +: baz fox +: +: +cmd +EOI +: foo bar +: bar baz +: +: baz fox +cmd +EOO + +$* <<EOI >>EOO # strip +: foo-bar +: bar baz +: +: baz fox +: fox biz +:biz buz +: +cmd +EOI +: id:foo-bar +: sm:bar baz +: +: baz fox +: fox biz +: biz buz +cmd +EOO + +# 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-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. +# + +# No merge since both have description. +# +$* -s -i <<EOI >>EOO # test-scope-both +: foo +{ + : bar + cmd +} +EOI +{ + : id:foo + { # foo + : id:bar + { # 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 + +$* -s -i <<EOI >>EOO # test-scope-test +{ + : foo-bar + : foo bar + cmd +} +EOI +{ + : id:foo-bar + : sm:foo bar + { # foo-bar + cmd + } +} +EOO + +# Id conflict once moved to outer scope. +# +$* <<EOI 2>>EOE != 0 # test-scope-id-dup +: foo +cmd +{ + : foo + cmd +} +cmd +EOI +testscript:4:3: error: duplicate id foo + testscript:1:1: info: previously used here +EOE |