mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-09 08:35:19 +02:00
12b21f032c
Total number of tests is now 109.
104 lines
1.8 KiB
Bash
Executable File
104 lines
1.8 KiB
Bash
Executable File
#!/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
|
|
|
|
###############################################################################
|