mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2025-04-21 12:27:27 +03:00
b2/test/: more substitution tests
Total number of tests is now 109.
This commit is contained in:
103
b2/test/sublast
Executable file
103
b2/test/sublast
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/bin/bash
|
||||
. ./Common
|
||||
|
||||
###############################################################################
|
||||
|
||||
tst "substitutions: expand \$ from regular var" -q X=foo <<EOF
|
||||
!-s
|
||||
X=?*? { Y=\$\$ }
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
Y=foo
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst "substitutions: expand \$ from FN" -q F1=bar <<EOF
|
||||
!-s
|
||||
FN=?*? { Y=\$\$ }
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
Y=bar
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst_fail "substitutions: expand \$ without match" <<EOF
|
||||
!-s
|
||||
X=\$\$
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
s:2: \$\$ without match
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst "substitutions: assign to \$ from regular var" -q X=bar <<EOF
|
||||
!-s
|
||||
X=?*? { \$=foo }
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
X=foo
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst "substitutions: assign to \$ from FN" -q F1=foo <<EOF
|
||||
!-s
|
||||
FN=?*? { \$=bar }
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
F1=bar
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst_fail "substitutions: assign to \$ without match" <<EOF
|
||||
!-s
|
||||
\$=bar
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
s:2: \$ without match
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst "substitutions: match \$ from regular var" -q X=bar <<EOF
|
||||
!-s
|
||||
X=?*? { \$=b(*) { Y=\$1 } }
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
Y=ar
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst "substitutions: match \$ from FN" -q F1=foo <<EOF
|
||||
!-s
|
||||
FN=?*? { \$=(*)o { Y=\$1 } }
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
Y=fo
|
||||
EOF
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
tst_fail "substitutions: match \$ without match" <<EOF
|
||||
!-s
|
||||
\$=* { X=X }
|
||||
EOF
|
||||
|
||||
expect <<EOF
|
||||
s:2: \$ without match
|
||||
EOF
|
||||
|
||||
###############################################################################
|
||||
Reference in New Issue
Block a user