1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 02:30:36 +02:00

b2/test/{subend,subign}: test end/ignore in substitutions

This commit is contained in:
Werner Almesberger 2012-06-03 21:22:16 -03:00
parent bca50f009f
commit a52247294b
2 changed files with 110 additions and 0 deletions

54
b2/test/subend Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
. ./Common
###############################################################################
tst "substitutions: unconditional end" -ds -q <<EOF
!-s
end
EOF
expect <<EOF
end
EOF
#------------------------------------------------------------------------------
tst "substitutions: conditional end, taken" -ds -q doit=y <<EOF
!-s
doit = y { end }
foo = x
EOF
expect <<EOF
doit=RE {
end
}
foo=x
EOF
#------------------------------------------------------------------------------
tst "substitutions: conditional end, not taken" -q doit=n <<EOF
!-s
doit = y { end }
foo = x
EOF
expect <<EOF
foo=x
EOF
#------------------------------------------------------------------------------
tst_fail "substitutions: code after end" -q <<EOF
!-s
end
foo = x
EOF
expect <<EOF
s:2: unreachable code
EOF
###############################################################################

56
b2/test/subign Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
. ./Common
###############################################################################
tst "substitutions: unconditional ignore" -ds -q <<EOF
!-s
ignore
EOF
expect <<EOF
ignore
ignore
EOF
#------------------------------------------------------------------------------
tst "substitutions: conditional ignore, taken" -ds -q doit=y <<EOF
!-s
doit = y { ignore }
foo = x
EOF
expect <<EOF
doit=RE {
ignore
}
foo=x
ignore
EOF
#------------------------------------------------------------------------------
tst "substitutions: conditional ignore, not taken" -q doit=n <<EOF
!-s
doit = y { ignore }
foo = x
EOF
expect <<EOF
foo=x
EOF
#------------------------------------------------------------------------------
tst_fail "substitutions: code after ignore" -q <<EOF
!-s
ignore
foo = x
EOF
expect <<EOF
s:2: unreachable code
EOF
###############################################################################