#!/bin/bash
. ./Common

###############################################################################

tst "substitutions: unconditional ignore" -ds -q <<EOF
!-s
ignore
EOF

expect <<EOF
ignore
ignore
EOF

#------------------------------------------------------------------------------

tst "substitutions: conditional ignore, taken" -ds -q doit=y <<EOF
!-s
doit = y { ignore }
foo = x
EOF

expect <<EOF
doit=RE {
    ignore
}
foo=x
ignore
EOF

#------------------------------------------------------------------------------

tst "substitutions: conditional ignore, not taken" -q doit=n <<EOF
!-s
doit = y { ignore }
foo = x
EOF

expect <<EOF
foo=x
EOF

#------------------------------------------------------------------------------

tst_fail "substitutions: code after ignore" -q <<EOF
!-s
ignore
foo = x
EOF

expect <<EOF
s:2: unreachable code
EOF

###############################################################################