diff options
Diffstat (limited to 'tests/parse.test')
-rw-r--r-- | tests/parse.test | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/parse.test b/tests/parse.test index daecce5..9764cf1 100644 --- a/tests/parse.test +++ b/tests/parse.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: parse.test,v 1.14 2003/04/01 07:18:37 dgp Exp $ +# RCS: @(#) $Id: parse.test,v 1.15 2003/04/01 17:08:16 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -813,6 +813,46 @@ test parse-18.21 {Tcl_SubstObj, exception handling} { } msg] $msg } [list 1 "extra characters after close-brace"] +test parse-18.22 {Tcl_SubstObj, side effects} { + set a 0 + list [subst {foo[incr a]bar}] $a +} [list foo1bar 1] +test parse-18.23 {Tcl_SubstObj, side effects} { + set a 0 + list [subst {foo[incr a; incr a]bar}] $a +} [list foo2bar 2] +test parse-18.24 {Tcl_SubstObj, side effects} { + set a 0 + list [subst {foo[incr a; break; incr a]bar}] $a +} [list foo 1] +test parse-18.25 {Tcl_SubstObj, side effects} { + set a 0 + list [subst {foo[incr a; continue; incr a]bar}] $a +} [list foobar 1] +test parse-18.26 {Tcl_SubstObj, side effects} { + set a 0 + list [subst {foo[incr a; return; incr a]bar}] $a +} [list foobar 1] +test parse-18.27 {Tcl_SubstObj, side effects} { + set a 0 + list [subst {foo[incr a; return -code 10; incr a]bar}] $a +} [list foobar 1] +test parse-18.28 {Tcl_SubstObj, side effects} { + set a 0 + catch {subst {foo[incr a; parse error {}{}; incr a]bar}} + set a +} 1 +test parse-18.29 {Tcl_SubstObj, side effects} { + set a 0 + catch {subst {foo[incr a; incr a; parse error {}{}]bar}} + set a +} 2 +test parse-18.30 {Tcl_SubstObj, side effects} { + set a 0 + catch {subst {foo[incr a; incr a parse error {}{}]bar}} + set a +} 1 + # cleanup catch {unset a} ::tcltest::cleanupTests |