From 616690fd06d1c5d05de97b88119dd8d328522df0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 26 Oct 2016 13:38:27 +0200 Subject: Implement support for testscript scopes --- unit-tests/test/script/parser/scope.test | 71 +++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 5 deletions(-) (limited to 'unit-tests/test/script/parser') 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 <>EOO # compound-2 +$* -s <>EOO # group-empty +{ +} +EOI +{ + { + } +} +EOO + +$* -s <>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 + +$* <>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 <>EOO # test-1 +cmd1 +EOI +{ + { + cmd1 + } +} +EOO + +$* -s <>EOO # test-2 cmd1; cmd2 EOI @@ -24,7 +85,7 @@ EOI } EOO -$* -s <>EOO # compound-3 +$* -s <>EOO # test-3 cmd1; cmd2; cmd3 @@ -38,7 +99,7 @@ EOI } EOO -$* -s <>EOO # compound-var +$* -s <>EOO # test-var cmd1; x = abc; cmd2 \$x @@ -51,7 +112,7 @@ EOI } EOO -$* -s <>EOO # compound-var-first +$* -s <>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 -$* <>EOE != 0 # expected-line +$* <>EOE != 0 # expected-line-eof cmd; EOI testscript:2:1: error: expected another line after semicolon -- cgit v1.1