1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2025-04-21 12:27:27 +03:00

b2/test/: add first set of substitution tests

This commit is contained in:
Werner Almesberger
2012-06-03 02:10:12 -03:00
parent b35b6e2688
commit fb7b2461a5
3 changed files with 375 additions and 0 deletions

48
b2/test/subfn Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
. ./Common
###############################################################################
tst "substitutions: F1 -> FN (expand \$\$)" -q F1=foo <<EOF
!-s
FN=* { RES=\$\$ }
EOF
expect <<EOF
RES=foo
EOF
#------------------------------------------------------------------------------
tst "substitutions: F2 -> FN (expand \$\$)" -q F1=foo F2=bar <<EOF
!-s
FN=?a? { RES=\$\$ }
EOF
expect <<EOF
RES=bar
EOF
#------------------------------------------------------------------------------
tst_fail "substitutions: F* -> FN (expand \$FN)" -q F1=foo <<EOF
!-s
FN=* { RES=\$FN }
EOF
expect <<EOF
s:2: \$FN may be undefined
EOF
#------------------------------------------------------------------------------
tst_fail "substitutions: assign to FN" <<EOF
!-s
FN=foo
EOF
expect <<EOF
s:2: can't assign to pseudo-variable FN
EOF
###############################################################################