diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-10-31 14:15:07 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-05-09 10:29:11 +1000 |
commit | 24bbe8f092cabff79c990a9ecca030002b9acb6d (patch) | |
tree | a4f96e5cece61f3004aa8c97e38ed23e3bb92eb9 /tests/proc-new.test | |
parent | 7474537fa2458d02f0e1efb97ba35fdd2e68db28 (diff) | |
download | jimtcl-24bbe8f092cabff79c990a9ecca030002b9acb6d.zip jimtcl-24bbe8f092cabff79c990a9ecca030002b9acb6d.tar.gz jimtcl-24bbe8f092cabff79c990a9ecca030002b9acb6d.tar.bz2 |
Allow proc 'args' to be renamed
With this syntax: {args newname}.
This especially helps with documentation and error messages.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/proc-new.test')
-rw-r--r-- | tests/proc-new.test | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/proc-new.test b/tests/proc-new.test index c771575..1178e0c 100644 --- a/tests/proc-new.test +++ b/tests/proc-new.test @@ -77,4 +77,25 @@ test proc-2.4 "Real test of optional switches" { multiarg_search -nocase -glob c* {A a B b C c D d} } 4 +test proc-3.1 "Rename optional args" { + proc a {b {args vars}} { + } + catch {a} msg + set msg +} {wrong # args: should be "a b ?vars ...?"} + +test proc-3.2 "Rename optional args" { + proc a {b {args vars} c} { + } + catch {a} msg + set msg +} {wrong # args: should be "a b ?vars ...? c"} + +test proc-3.2 "Rename optional args" { + proc a {b {args vars}} { + return $vars + } + a B C D +} {C D} + testreport |