aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/test/script/parser/scope-if.test
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-01-06 18:46:58 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-01-09 21:44:23 +0300
commitc55240fb05151cae046c75a793c164d72c988db2 (patch)
tree35cbba195e0fcc581944b7b098a3ea145741cf94 /unit-tests/test/script/parser/scope-if.test
parent9e2b4fd3bbc0c61bf6c84540c52869ec7d830718 (diff)
Tests cleanup (take 2)
Diffstat (limited to 'unit-tests/test/script/parser/scope-if.test')
-rw-r--r--unit-tests/test/script/parser/scope-if.test681
1 files changed, 353 insertions, 328 deletions
diff --git a/unit-tests/test/script/parser/scope-if.test b/unit-tests/test/script/parser/scope-if.test
index e04c47e..4f524cf 100644
--- a/unit-tests/test/script/parser/scope-if.test
+++ b/unit-tests/test/script/parser/scope-if.test
@@ -1,365 +1,450 @@
-: if-true
+# file : unit-tests/test/script/parser/scope-if.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+: if
:
-$* -s <<EOI >>EOO
-if true foo
-{
- cmd
-}
-EOI
{
- ? true foo
+ : true
+ :
+ $* -s <<EOI >>EOO
+ if true foo
{
cmd
}
-}
-EOO
+ EOI
+ {
+ ? true foo
+ {
+ cmd
+ }
+ }
+ EOO
-: if-false
-:
-$* -s <<EOI >>EOO
-if false foo
-{
- cmd
-}
-EOI
-{
- ? false foo
-}
-EOO
+ : false
+ :
+ $* -s <<EOI >>EOO
+ if false foo
+ {
+ cmd
+ }
+ EOI
+ {
+ ? false foo
+ }
+ EOO
-: ifn-true
-:
-$* -s <<EOI >>EOO
-if! true
-{
- cmd
-}
-EOI
-{
- ? true
-}
-EOO
+ : not-true
+ :
+ $* -s <<EOI >>EOO
+ if! true
+ {
+ cmd
+ }
+ EOI
+ {
+ ? true
+ }
+ EOO
-: ifn-false
-:
-$* -s <<EOI >>EOO
-if! false
-{
- cmd
-}
-EOI
-{
- ? false
+ : not-false
+ :
+ $* -s <<EOI >>EOO
+ if! false
{
cmd
}
+ EOI
+ {
+ ? false
+ {
+ cmd
+ }
+ }
+ EOO
+
+ : eos-inside
+ :
+ $* <<EOI 2>>EOE != 0
+ if
+ {
+ EOI
+ testscript:3:1: error: expected '}' at the end of the scope
+ EOE
+
}
-EOO
-: elif-true
+: elif
:
-$* -s <<EOI >>EOO
-if false
-{
- cmd
-}
-elif true
{
- cmd1
-}
-EOI
-{
- ? false
- ? true
+ : true
+ :
+ $* -s <<EOI >>EOO
+ if false
+ {
+ cmd
+ }
+ elif true
{
cmd1
}
-}
-EOO
+ EOI
+ {
+ ? false
+ ? true
+ {
+ cmd1
+ }
+ }
+ EOO
-: elif-false
-:
-$* -s <<EOI >>EOO
-if false
-{
- cmd
-}
-elif false
-{
- cmd
-}
-EOI
-{
- ? false
- ? false
-}
-EOO
+ : false
+ :
+ $* -s <<EOI >>EOO
+ if false
+ {
+ cmd
+ }
+ elif false
+ {
+ cmd
+ }
+ EOI
+ {
+ ? false
+ ? false
+ }
+ EOO
-: elifn-false
-:
-$* -s <<EOI >>EOO
-if false
-{
- cmd
-}
-elif! false
-{
- cmd1
-}
-EOI
-{
- ? false
- ? false
+ : not-false
+ :
+ $* -s <<EOI >>EOO
+ if false
+ {
+ cmd
+ }
+ elif! false
{
cmd1
}
-}
-EOO
+ EOI
+ {
+ ? false
+ ? false
+ {
+ cmd1
+ }
+ }
+ EOO
-: elifn-true
-:
-$* -s <<EOI >>EOO
-if false
-{
- cmd
-}
-elif! true
-{
- cmd
-}
-EOI
-{
- ? false
- ? true
-}
-EOO
+ : not-true
+ :
+ $* -s <<EOI >>EOO
+ if false
+ {
+ cmd
+ }
+ elif! true
+ {
+ cmd
+ }
+ EOI
+ {
+ ? false
+ ? true
+ }
+ EOO
-: else-true
-:
-$* -s <<EOI >>EOO
-if false
-{
- cmd
-}
-else
-{
- cmd1
-}
-EOI
-{
- ? false
+ : after-else
+ :
+ $* <<EOI 2>>EOE != 0
+ if false
{
- cmd1
+ cmd
+ }
+ else
+ {
+ cmd
+ }
+ elif true
+ {
+ cmd
}
+ EOI
+ testscript:9:1: error: 'elif' after 'else'
+ EOE
}
-EOO
-: else-false
+: else
:
-$* -s <<EOI >>EOO
-if true
-{
- cmd1
-}
-else
{
- cmd
-}
-EOI
-{
- ? true
+ : true
+ :
+ $* -s <<EOI >>EOO
+ if false
+ {
+ cmd
+ }
+ else
{
cmd1
}
-}
-EOO
-
-: if-chain
-:
-$* -s <<EOI >>EOO
-if false
-{
- cmd
-}
-elif false
-{
- cmd
- cmd
-}
-elif false
-{
- cmd
-}
-elif true
-{
- cmd1
- cmd2
-}
-elif false
-{
- cmd
-}
-else
-{
- cmd
- cmd
-}
-EOI
-{
- ? false
- ? false
- ? false
- ? true
+ EOI
{
+ ? false
{
cmd1
}
+ }
+ EOO
+
+ : false
+ :
+ $* -s <<EOI >>EOO
+ if true
+ {
+ cmd1
+ }
+ else
+ {
+ cmd
+ }
+ EOI
+ {
+ ? true
{
- cmd2
+ cmd1
}
}
-}
-EOO
+ EOO
-: nested-take
-:
-$* -s <<EOI >>EOO
-if true
-{
- cmd1
+ : chain
+ :
+ $* -s <<EOI >>EOO
if false
{
cmd
}
elif false
{
- if true
- {
- cmd
- }
+ cmd
+ cmd
}
- else
+ elif false
+ {
+ cmd
+ }
+ elif true
{
+ cmd1
cmd2
}
- cmd3
-}
-EOI
-{
- ? true
+ elif false
{
- {
- cmd1
- }
+ cmd
+ }
+ else
+ {
+ cmd
+ cmd
+ }
+ EOI
+ {
+ ? false
? false
? false
+ ? true
{
{
+ cmd1
+ }
+ {
cmd2
}
}
- {
- cmd3
- }
}
-}
-EOO
+ EOO
-: nested-skip
-:
-$* -s <<EOI >>EOO
-if false
-{
- cmd1
+ : scope-expected
+ :
+ $* <<EOI 2>>EOE != 0
+ if
+ {
+ cmd
+ }
+ else
+ cmd
+ EOI
+ testscript:5:1: error: expected scope after 'else'
+ EOE
+
+ : after-else
+ :
+ $* <<EOI 2>>EOE != 0
if false
{
cmd
}
- elif false
+ else
{
- if true
- {
- cmd
- }
+ cmd
}
else
{
- cmd2
+ cmd
}
- cmd3
+ EOI
+ testscript:9:1: error: 'else' after 'else'
+ EOE
}
-else
-{
- cmd
-}
-EOI
+
+: nested
+:
{
- ? false
+ : take
+ :
+ $* -s <<EOI >>EOO
+ if true
{
+ cmd1
+ if false
{
cmd
}
+ elif false
+ {
+ if true
+ {
+ cmd
+ }
+ }
+ else
+ {
+ cmd2
+ }
+ cmd3
}
-}
-EOO
+ EOI
+ {
+ ? true
+ {
+ {
+ cmd1
+ }
+ ? false
+ ? false
+ {
+ {
+ cmd2
+ }
+ }
+ {
+ cmd3
+ }
+ }
+ }
+ EOO
-: demote-group
-: Chain remains a group
-:
-$* -s <<EOI >>EOO
-if false
-{
- cmd
-}
-elif true
-{
- cmd1
- cmd2
-}
-else
-{
- cmd
-}
-EOI
-{
- ? false
- ? true
+ : skip
+ :
+ $* -s <<EOI >>EOO
+ if false
{
+ cmd1
+ if false
{
- cmd1
+ cmd
}
+ elif false
+ {
+ if true
+ {
+ cmd
+ }
+ }
+ else
{
cmd2
}
+ cmd3
+ }
+ else
+ {
+ cmd
+ }
+ EOI
+ {
+ ? false
+ {
+ {
+ cmd
+ }
+ }
}
+ EOO
}
-EOO
-: demote-test
-: Chain demoted to test
+: demote
:
-$* -s <<EOI >>EOO
-if false
{
- cmd
-}
-elif true
-{
- cmd1
-}
-else
-{
- cmd
-}
-EOI
-{
- ? false
- ? true
+ : group
+ : Chain remains a group
+ :
+ $* -s <<EOI >>EOO
+ if false
+ {
+ cmd
+ }
+ elif true
+ {
+ cmd1
+ cmd2
+ }
+ else
+ {
+ cmd
+ }
+ EOI
+ {
+ ? false
+ ? true
+ {
+ {
+ cmd1
+ }
+ {
+ cmd2
+ }
+ }
+ }
+ EOO
+
+ : test
+ : Chain demoted to test
+ :
+ $* -s <<EOI >>EOO
+ if false
+ {
+ cmd
+ }
+ elif true
{
cmd1
}
+ else
+ {
+ cmd
+ }
+ EOI
+ {
+ ? false
+ ? true
+ {
+ cmd1
+ }
+ }
+ EOO
}
-EOO
: line-index
: Make sure command line index spans setup/if/teardown
@@ -467,63 +552,3 @@ EOI
}
}
EOO
-
-: eos-inside
-:
-$* <<EOI 2>>EOE != 0
-if
-{
-EOI
-testscript:3:1: error: expected '}' at the end of the scope
-EOE
-
-: scope-expected
-:
-$* <<EOI 2>>EOE != 0
-if
-{
- cmd
-}
-else
-cmd
-EOI
-testscript:5:1: error: expected scope after 'else'
-EOE
-
-: else-after-else
-:
-$* <<EOI 2>>EOE != 0
-if false
-{
- cmd
-}
-else
-{
- cmd
-}
-else
-{
- cmd
-}
-EOI
-testscript:9:1: error: 'else' after 'else'
-EOE
-
-: elif-after-else
-:
-$* <<EOI 2>>EOE != 0
-if false
-{
- cmd
-}
-else
-{
- cmd
-}
-elif true
-{
- cmd
-}
-EOI
-testscript:9:1: error: 'elif' after 'else'
-EOE