diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-26 13:38:27 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:35 +0200 |
commit | 616690fd06d1c5d05de97b88119dd8d328522df0 (patch) | |
tree | a7e212f33d30efb598464571b23531621064e5c9 /unit-tests | |
parent | 8fabd86e687ef9455f1b31abbe0b44876afdecab (diff) |
Implement support for testscript scopes
Diffstat (limited to 'unit-tests')
-rw-r--r-- | unit-tests/test/script/lexer/first-token.test | 12 | ||||
-rw-r--r-- | unit-tests/test/script/lexer/second-token.test | 2 | ||||
-rw-r--r-- | unit-tests/test/script/parser/scope.test | 71 |
3 files changed, 78 insertions, 7 deletions
diff --git a/unit-tests/test/script/lexer/first-token.test b/unit-tests/test/script/lexer/first-token.test index fb75c8b..a433362 100644 --- a/unit-tests/test/script/lexer/first-token.test +++ b/unit-tests/test/script/lexer/first-token.test @@ -2,11 +2,21 @@ # test.arguments += first-token -$* <";" >>EOO # semi-only +$* <";" >>EOO # semi ; <newline> EOO +$* <"{" >>EOO # lcbrace +{ +<newline> +EOO + +$* <"}" >>EOO # rcbrace +} +<newline> +EOO + $* <"+foo" >>EOO # setup + 'foo' diff --git a/unit-tests/test/script/lexer/second-token.test b/unit-tests/test/script/lexer/second-token.test index cc044dd..058dc65 100644 --- a/unit-tests/test/script/lexer/second-token.test +++ b/unit-tests/test/script/lexer/second-token.test @@ -2,7 +2,7 @@ # test.arguments += second-token -$* <";" >>EOO # semi-only +$* <";" >>EOO # semi ; <newline> EOO diff --git a/unit-tests/test/script/parser/scope.test b/unit-tests/test/script/parser/scope.test index 4e358f3..593dbb2 100644 --- a/unit-tests/test/script/parser/scope.test +++ b/unit-tests/test/script/parser/scope.test @@ -12,7 +12,68 @@ wd += foo; wd += 1; $* foo.test <'cmd $~' >"cmd $wd" # wd -$* -s <<EOI >>EOO # compound-2 +$* -s <<EOI >>EOO # group-empty +{ +} +EOI +{ + { + } +} +EOO + +$* -s <<EOI >>EOO # group +{ + cmd1 + cmd2 +} +EOI +{ + { + { + cmd1 + } + { + cmd2 + } + } +} +EOO + +$* <:"{x" 2>>EOE != 0 # expected-newline-lcbrace +testscript:1:2: error: expected newline after '{' +EOE + +$* <"{" 2>>EOE != 0 # expected-rcbrace +testscript:2:1: error: expected '}' at the end of the scope +EOE + +$* <<EOI 2>>EOE != 0 # expected-line-rcbrace +{ + cmd; +} +EOI +testscript:3:1: error: expected another line after semicolon +EOE + +$* <<:EOI 2>>EOE != 0 # expected-newline-rcbrace +{ +} +EOI +testscript:2:2: error: expected newline after '}' +EOE + +$* -s <<EOI >>EOO # test-1 +cmd1 +EOI +{ + { + cmd1 + } +} +EOO + +$* -s <<EOI >>EOO # test-2 cmd1; cmd2 EOI @@ -24,7 +85,7 @@ EOI } EOO -$* -s <<EOI >>EOO # compound-3 +$* -s <<EOI >>EOO # test-3 cmd1; cmd2; cmd3 @@ -38,7 +99,7 @@ EOI } EOO -$* -s <<EOI >>EOO # compound-var +$* -s <<EOI >>EOO # test-var cmd1; x = abc; cmd2 \$x @@ -51,7 +112,7 @@ EOI } EOO -$* -s <<EOI >>EOO # compound-var-first +$* -s <<EOI >>EOO # test-var-first x = abc; cmd \$x EOI @@ -83,7 +144,7 @@ testscript:3:1: error: test after teardown testscript:2:1: info: last teardown line appears here EOE -$* <<EOI 2>>EOE != 0 # expected-line +$* <<EOI 2>>EOE != 0 # expected-line-eof cmd; EOI testscript:2:1: error: expected another line after semicolon |