diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-06-16 10:27:27 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-07-08 05:41:58 +1000 |
commit | 4a5e4965e2c208375a77d40b831a07897f80ee50 (patch) | |
tree | 8d9ea6efb78a2a884ac347b59b3d48740eda0349 /tests | |
parent | e3639458879e363cf012a1f7a00fdfab92f0f7ce (diff) | |
download | jimtcl-4a5e4965e2c208375a77d40b831a07897f80ee50.zip jimtcl-4a5e4965e2c208375a77d40b831a07897f80ee50.tar.gz jimtcl-4a5e4965e2c208375a77d40b831a07897f80ee50.tar.bz2 |
Better proc optional arg handling
Allows args and optional parameters in any location,
in addition to being smaller and faster.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/proc-new.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/proc-new.test b/tests/proc-new.test index 9f18f64..8703748 100644 --- a/tests/proc-new.test +++ b/tests/proc-new.test @@ -28,6 +28,14 @@ proc hproc {{a aa} args} { list a $a args $args } +proc iproc {{a aa} b {c cc}} { + list a $a b $b c $c +} + +proc jproc {args {a aa} b {c cc} d} { + list a $a b $b c $c d $d args $args +} + set n 1 foreach {proc params result} { aproc {} {} @@ -48,6 +56,13 @@ foreach {proc params result} { hproc {} {a aa args {}} hproc {A} {a A args {}} hproc {A X Y Z} {a A args {X Y Z}} + iproc {B} {a aa b B c cc} + iproc {A B} {a A b B c cc} + iproc {A B C} {a A b B c C} + jproc {B D} {a aa b B c cc d D args {}} + jproc {A B D} {a A b B c cc d D args {}} + jproc {A B C D} {a A b B c C d D args {}} + jproc {E F A B C D} {a A b B c C d D args {E F}} } { test proc-1.$n "Proc args combos" [list $proc {*}$params] $result incr n |