Index: library/nx/nx.tcl =================================================================== diff -u -r8be635fcabc150f3922951c71d9919d62db09b10 -r0f683270c600d1bbf44a52cb80ee49744c6c1034 --- library/nx/nx.tcl (.../nx.tcl) (revision 8be635fcabc150f3922951c71d9919d62db09b10) +++ library/nx/nx.tcl (.../nx.tcl) (revision 0f683270c600d1bbf44a52cb80ee49744c6c1034) @@ -1972,12 +1972,12 @@ lappend options [expr {[::nsf::is metaclass $type] ? "class" : "object"}] type=$type } else { lappend options $type - if {!$forInfo && $type ni [list "" \ - "boolean" "integer" "object" "class" \ - "metaclass" "baseclass" "parameter" \ - "alnum" "alpha" "ascii" "control" "digit" "double" \ - "false" "graph" "lower" "print" "punct" "space" "true" \ - "wideinteger" "wordchar" "xdigit" ]} { + if {$type ni [list "" \ + "boolean" "switch" "integer" "object" "class" \ + "metaclass" "baseclass" "parameter" \ + "alnum" "alpha" "ascii" "control" "digit" "double" \ + "false" "graph" "lower" "print" "punct" "space" "true" \ + "wideinteger" "wordchar" "xdigit" ]} { lappend options slot=[::nsf::self] } } Index: tests/info-variable.test =================================================================== diff -u -r8be635fcabc150f3922951c71d9919d62db09b10 -r0f683270c600d1bbf44a52cb80ee49744c6c1034 --- tests/info-variable.test (.../info-variable.test) (revision 8be635fcabc150f3922951c71d9919d62db09b10) +++ tests/info-variable.test (.../info-variable.test) (revision 0f683270c600d1bbf44a52cb80ee49744c6c1034) @@ -208,22 +208,30 @@ } nx::test case switch-params { + + set ::p1 "p1:boolean" + set ::p2 "p2:switch" + set cls [nx::Class new { - :property p1:boolean - :property p2:switch + :property $::p1 + :property $::p2 }] ? [list lmap p [$cls info variables] "[list $cls info variable parameter] \$p"] \ - "p1:boolean p2:switch" + [list $::p1 $::p2] ? [list lmap p [$cls info variables] "[list $cls info variable definition] \$p"] \ - [list [list $cls property -accessor none p1:boolean] \ - [list $cls property -accessor none p2:switch]] -} + [list [list $cls property -accessor none $::p1] \ + [list $cls property -accessor none $::p2]] -# TODO: switch on method parameters + info? -# TODO: switch as sugar for boolean,noarg for nonpos? + set obj [$cls new] + set ::lookupParams [$obj info lookup parameters configure] + ? {expr {"-$::p1" in $::lookupParams}} 1 + ? {expr {"-$::p2" in $::lookupParams}} 1 + ? [list string match "?-p1 /boolean/? ?-p2? *" [$obj info lookup syntax configure]] 1 +} + nx::test case object-variables { nx::Class create Bar { :property {p 9} Index: tests/nsf-cmd.test =================================================================== diff -u -rb44ba341aa4dc2d759201f6413dc2ef36eba555d -r0f683270c600d1bbf44a52cb80ee49744c6c1034 --- tests/nsf-cmd.test (.../nsf-cmd.test) (revision b44ba341aa4dc2d759201f6413dc2ef36eba555d) +++ tests/nsf-cmd.test (.../nsf-cmd.test) (revision 0f683270c600d1bbf44a52cb80ee49744c6c1034) @@ -777,8 +777,24 @@ namespace delete ::ns1 } +nx::test case switch-info { + namespace eval ::ns1 {} + set handle ::n1::foo + set params [list -p1:boolean -p2:switch args] + set def [list ::nsf::proc $handle $params return] + {*}$def + ? [list nsf::cmd::info args $handle] "p1 p2 args" + ? [list nsf::cmd::info definition $handle] $def + ? [list nsf::cmd::info exists $handle] 1 + ? [list nsf::cmd::info parameter $handle] $params + ? [list nsf::cmd::info syntax $handle] "?-p1 /boolean/? ?-p2? ?/arg .../?" + + namespace delete ::ns1 +} + + # - TO-DO: interp hide/expose