Index: tests/method-parameter.test =================================================================== diff -u -r59e100d383b22ea1407f5e5c40e303f2c6bb9027 -r4bc60e16c10fdbbb640b3019d4bdebdc469fdf55 --- tests/method-parameter.test (.../method-parameter.test) (revision 59e100d383b22ea1407f5e5c40e303f2c6bb9027) +++ tests/method-parameter.test (.../method-parameter.test) (revision 4bc60e16c10fdbbb640b3019d4bdebdc469fdf55) @@ -2,7 +2,7 @@ package require nx package require nx::test -nx::Test case method-params-0 { +nx::test case method-params-0 { nsf::proc p0 {} {return 1} nsf::proc p1 {-x} {return [list [info exists x]]} @@ -13,17 +13,17 @@ ? {p1} 0 ? {p1 -x} {value for parameter '-x' expected} ? {p1 -x 1} 1 - ? {p1 -x 1 2} {invalid argument '2', maybe too many arguments; should be "p1 ?-x value?"} + ? {p1 -x 1 2} {invalid argument '2', maybe too many arguments; should be "p1 ?-x /value/?"} ? {p1 -x 1 -y} {invalid non-positional argument '-y', valid are : -x; - should be "p1 ?-x value?"} - ? {p1 a} {invalid argument 'a', maybe too many arguments; should be "p1 ?-x value?"} - ? {p1 a -x} {invalid argument 'a', maybe too many arguments; should be "p1 ?-x value?"} + should be "p1 ?-x /value/?"} + ? {p1 a} {invalid argument 'a', maybe too many arguments; should be "p1 ?-x /value/?"} + ? {p1 a -x} {invalid argument 'a', maybe too many arguments; should be "p1 ?-x /value/?"} ? {p1 --} 0 ? {p1 -y} {invalid non-positional argument '-y', valid are : -x; - should be "p1 ?-x value?"} + should be "p1 ?-x /value/?"} ? {p1 -y --} {invalid non-positional argument '-y', valid are : -x; - should be "p1 ?-x value?"} + should be "p1 ?-x /value/?"} # # should we really allow numeric nonpos arg names? @@ -38,7 +38,7 @@ -nx::Test case noleadingdash { +nx::test case noleadingdash { nsf::proc p2a {-x args} {return [list [info exists x] $args]} nsf::proc p2b {-x args:noleadingdash} {return [list [info exists x] $args]} @@ -50,33 +50,33 @@ ? {p2a -x 1 -y} {1 -y} ? {p2b -x 1 -y} {invalid non-positional argument '-y', valid are : -x; - should be "p2b ?-x value? ?arg ...?"} + should be "p2b ?-x /value/? ?/arg .../?"} ? {p2c -x 1 -y} {invalid non-positional argument '-y', valid are : -x; - should be "p2c ?-x value? ?arg ...?"} + should be "p2c ?-x /value/? ?/arg .../?"} nsf::proc p3a {a -x -y b:noleadingdash -z} {return [list $a [info exists x] [info exists y] $b]} ? {p3a 100 -x 1 -y 1 200} {100 1 1 200} ? {p3a 100 -xx 1 -y 1 200} {invalid non-positional argument '-xx', valid are : -x, -y; - should be "p3a a ?-x value? ?-y value? b ?-z value?"} + should be "p3a /a/ ?-x /value/? ?-y /value/? /b/ ?-z /value/?"} } -nx::Test case unknown-handler { +nx::test case unknown-handler { Class create C { :public method p1 {-x} {return [list [info exists x]]} :create c1 } ? {c1 p1 -x 1 -y} {invalid non-positional argument '-y', valid are : -x; - should be "::c1 p1 ?-x value?"} + should be "::c1 p1 ?-x /value/?"} proc ::nsf::argument::unknown {method arg args} { puts stderr "??? unknown nonpos-arg $arg in $method obj <$args>\n[info frame -1]\n" return "" } ? {c1 p1 -x 1 -y} {invalid non-positional argument '-y', valid are : -x; - should be "::c1 p1 ?-x value?"} + should be "::c1 p1 ?-x /value/?"} if {0} { proc ::nsf::argument::unknown {method arg args} { @@ -87,6 +87,13 @@ } ? {c1 p1 -x 1 -y} {invalid non-positional argument '-y', valid are : -x; - should be "::c1 p1 ?-x value?"} + should be "::c1 p1 ?-x /value/?"} } } + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: