1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-25 22:55:20 +02:00

b2/test/subcont: test "continue" in substitutions

This commit is contained in:
Werner Almesberger 2012-06-03 13:32:13 -03:00
parent 31c1c58691
commit e56a71e914

129
b2/test/subcont Executable file
View File

@ -0,0 +1,129 @@
#!/bin/bash
. ./Common
###############################################################################
tst "substitutions: continue" -ds -q <<EOF
!-s
in = blah
out = x
in = (?)(*) {
out = \$out\$1\$1
in = \$2
continue
}
EOF
expect <<EOF
in=blah
out=x
in=RE {
out=\${out}\$1\$1
in=\$2
continue in
}
in=
out=xbbllaahh
EOF
#------------------------------------------------------------------------------
tst "substitutions: named continue to inner block" -q x=abc <<EOF
!-s
z = x
x = (?)(*) {
x = \$2
y = \$x
y = (*)(?) {
z = \$z\$y\$2
y = \$1
continue y
}
}
EOF
expect <<EOF
z=xbccbb
x=bc
y=
EOF
#------------------------------------------------------------------------------
tst "substitutions: named continue to outer block" -q x=abc <<EOF
!-s
z = x
x = (?)(*) {
x = \$2
y = \$x
y = (*)(?) {
z = \$z\$y\$2
y = \$1
continue x
}
}
EOF
expect <<EOF
z=xbcccc
x=
y=
EOF
#------------------------------------------------------------------------------
tst "substitutions: continue to \$" -ds -q <<EOF
!-s
in = blah
out = x
in = ?(*) {
in = \$1
out = \${out}+
continue \$
}
EOF
expect <<EOF
in=blah
out=x
in=RE {
in=\$1
out=\${out}+
continue in
}
in=
out=x++++
EOF
#------------------------------------------------------------------------------
tst_fail "substitutions: continue inside block" <<EOF
!-s
foo = * {
continue
bar = x
}
EOF
expect <<EOF
s:3: syntax error
EOF
#------------------------------------------------------------------------------
tst_fail "substitutions: named continue to unknown block" -q <<EOF
!-s
x = foo
x = * {
y = \$x
y = * {
continue z
}
}
EOF
expect <<EOF
s:8: cannot find "z"
EOF
###############################################################################