summaryrefslogtreecommitdiffstats
path: root/tests/opt.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/opt.test')
-rw-r--r--tests/opt.test29
1 files changed, 26 insertions, 3 deletions
diff --git a/tests/opt.test b/tests/opt.test
index 0b35b76..72efead 100644
--- a/tests/opt.test
+++ b/tests/opt.test
@@ -1,4 +1,4 @@
-# Package covered: opt0.1/optparse.tcl
+# Package covered: opt1.0/optparse.tcl
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands. Sourcing this file into Tcl runs the tests and
@@ -10,12 +10,12 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# SCCS: @(#) opt.test 1.2 97/08/20 15:57:18
+# SCCS: @(#) opt.test 1.7 98/01/07 17:07:52
if {[string compare test [info procs test]] == 1} then {source defs}
# the package we are going to test
-package require opt 0.1
+package require opt 0.4.1
# we are using implementation specifics to test the package
@@ -253,3 +253,26 @@ test opt-10.10 {medium size overall test} {
list [catch {optTest save tst foo} msg] [lindex [split $msg "\n"] 0]
} {1 {too many arguments (unexpected argument(s): foo), usage:}}
+
+test opt-11.1 {too many args test 2} {
+ set key [::tcl::OptKeyRegister {-foo}]
+ list [catch {::tcl::OptKeyParse $key {-foo blah}} msg] $msg\
+ [::tcl::OptKeyDelete $key]
+} {1 {too many arguments (unexpected argument(s): blah), usage:
+ Var/FlagName Type Value Help
+ ------------ ---- ----- ----
+ ( -help gives this help )
+ -foo boolflag (false) } {}}
+
+
+
+test opt-11.2 {default value for args} {
+ set args {}
+ set key [::tcl::OptKeyRegister {{args -list {a b c} "args..."}}]
+ ::tcl::OptKeyParse $key {}
+ ::tcl::OptKeyDelete $key
+ set args
+} {a b c}
+
+
+return