mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 23:44:39 +02:00
130 lines
1.7 KiB
Plaintext
130 lines
1.7 KiB
Plaintext
|
#!/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
|
||
|
|
||
|
###############################################################################
|