Index: TODO =================================================================== diff -u -raeb4c8b743c038290c9e15770669c6a50381a464 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- TODO (.../TODO) (revision aeb4c8b743c038290c9e15770669c6a50381a464) +++ TODO (.../TODO) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -2632,9 +2632,16 @@ (second round of default value setting seems not necessary) - nx.tcl: some cleanup +- test.tcl: + * don't export Test per-default + * define Test as nx::Test + * make Test parameter count 1 the default, change to higher numbers where needed TODO: +- maybe change nx::Test to nx::test (user never has to know that nx::Test is a class). +- maybe move -count to the test case (but then a test-case less test needs a change of method) + - the scripted init block is called before init. If the default setting of the default parameters depend on each other, this has to be set in the "init". But this won't be available in the init block. Index: library/lib/test.tcl =================================================================== diff -u -r4945c44cd9b786e807c613dbdfeca88f590d1bd6 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- library/lib/test.tcl (.../test.tcl) (revision 4945c44cd9b786e807c613dbdfeca88f590d1bd6) +++ library/lib/test.tcl (.../test.tcl) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,11 +1,11 @@ package provide nx::test 1.0 package require nx -namespace eval ::nx::test { +namespace eval ::nx { # @file Simple regression test support for XOTcl / NX - nx::Class create Test { + nx::Class create nx::Test { # # Class Test is used to configure test instances, which can # be configured by the following parameters: @@ -24,7 +24,7 @@ :attribute {namespace ::} :attribute {verbose 0} :attribute {expected 1} - :attribute {count 100} + :attribute {count 1} :attribute msg :attribute setResult :attribute errorReport @@ -125,14 +125,12 @@ set namespace [uplevel {::namespace current}] #puts stderr "eval in namespace $namespace" if {$msg ne ""} { - set t [Test new -cmd $cmd -msg $msg -namespace $namespace] + set t [nx::Test new -cmd $cmd -msg $msg -namespace $namespace] } else { - set t [Test new -cmd $cmd -namespace $namespace] + set t [nx::Test new -cmd $cmd -namespace $namespace] } $t expected $expected $t run nsf::__db_run_assertions } - -namespace import ::nx::test::* Index: library/xotcl/tests/slottest.xotcl =================================================================== diff -u -r1d20679c48b53f85dcfd6d0be12a06c0776e797d -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision 1d20679c48b53f85dcfd6d0be12a06c0776e797d) +++ library/xotcl/tests/slottest.xotcl (.../slottest.xotcl) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -2,7 +2,7 @@ package require XOTcl; namespace import -force ::xotcl::* package require nx::test -Test parameter count 1000 +nx::Test parameter count 1000 # what's new: # - slots instances are manager objects for slot values @@ -352,7 +352,7 @@ #puts [A serialize] ################### -Test case req-param { +nx::Test case req-param { ::xotcl::Class create C -parameter {y:required x:required} C instproc init args {set ::_ $args} @@ -454,7 +454,7 @@ ####################################################### # defaultcmd via slots ####################################################### -Test case defaultcmd +nx::Test case defaultcmd set ::hu 0 Class C -slots { Attribute create x -defaultcmd {incr ::hu; set x 101} @@ -468,7 +468,7 @@ ####################################################### # nested contains ####################################################### -Test case nested-contains +nx::Test case nested-contains Class Point -parameter {{x 100} {y 300}} Class Rectangle -parameter {color} @@ -500,7 +500,7 @@ ####################################################### # assign via slots ####################################################### -Test case assign-via-slots +nx::Test case assign-via-slots Class create A -slots { Attribute create foo -default 1 { Index: library/xotcl/tests/speedtest.xotcl =================================================================== diff -u -rcc94b154709f9bd3393fbbdb9af982a30b57dee0 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- library/xotcl/tests/speedtest.xotcl (.../speedtest.xotcl) (revision cc94b154709f9bd3393fbbdb9af982a30b57dee0) +++ library/xotcl/tests/speedtest.xotcl (.../speedtest.xotcl) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,8 +1,8 @@ # -*- Tcl -*- #memory trace on package require XOTcl; namespace import ::xotcl::* +package require nx::test; namespace import nx::Test -package require nx::test Test parameter count 1000 @ @File {description { Index: library/xotcl/tests/xocomm.test =================================================================== diff -u -ra7b06fee23b709e9b7033e1de5b31cd81b00ead0 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- library/xotcl/tests/xocomm.test (.../xocomm.test) (revision a7b06fee23b709e9b7033e1de5b31cd81b00ead0) +++ library/xotcl/tests/xocomm.test (.../xocomm.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -66,13 +66,13 @@ # \tstatus-code: \[\[r0 set token\] set responseCode\]" #}}} -Test new -msg "Trying to load image logo-100.jpg ... " -count 1 \ +nx::Test new -msg "Trying to load image logo-100.jpg ... " -count 1 \ -verbose 1 \ -pre "puts starting..." \ -setResult {expr {[r0::sink set contentLength] == 1706}} \ -cmd [list SimpleRequest r0 -url http://$hostport/logo-100.jpg] \ -Test new -msg "Trying to PUT a file on web-server ... " -count 1 \ +nx::Test new -msg "Trying to PUT a file on web-server ... " -count 1 \ -setResult {expr [[r0 set token] set responseCode] == 201} \ -pre [list file delete -force $dir/../doc/junk.junk] \ -cmd [list SimpleRequest r0 \ @@ -81,28 +81,28 @@ -data "this is a test\n" \ -contentType plain/text] -Test new -msg "And download it again ... " -count 1 \ +nx::Test new -msg "And download it again ... " -count 1 \ -setResult {expr [r0 getContentLength] == 15} \ -post {file delete -force ../doc/junk.junk} \ -cmd [list SimpleRequest r0 -url http://$hostport/junk.junk] -Test new -msg "Get protected resource ... " -count 1 \ +nx::Test new -msg "Get protected resource ... " -count 1 \ -setResult {expr [r0 getContentLength] > 500} \ -cmd [list SimpleRequest r0 -url http://$protectedhostport/ ] -#Test new -msg "Try an FTP request $ftpURL ... " -count 1 \ +#nx::Test new -msg "Try an FTP request $ftpURL ... " -count 1 \ -setResult {expr [r0 getContentLength] > 100} \ -cmd [list SimpleRequest r0 -url $ftpURL] -#Test new -msg "Try timeout with slow URL $slowURL ... " -count 1 \ +#nx::Test new -msg "Try timeout with slow URL $slowURL ... " -count 1 \ -setResult {expr {[[r0 set token] set errormsg] == {timeout exceeded}}} \ -cmd [list SimpleRequest r0 -url $slowURL -timeout 100] -Test new -msg terminate -count 1 \ +nx::Test new -msg terminate -count 1 \ -setResult {set x 1} \ -cmd [list SimpleRequest r0 -url http://$protectedhostport/exit] \ -post exit -after 1000 {Test run} +after 1000 {nx::Test run} catch {vwait forever} Index: tests/alias.test =================================================================== diff -u -rb3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/alias.test (.../alias.test) (revision b3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b) +++ tests/alias.test (.../alias.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,7 +1,8 @@ # -*- Tcl -*- -package require nx; namespace import -force ::nx::* +package require nx; #::nx::configure defaultMethodCallProtection false package require nx::test +namespace import ::nx::* Test parameter count 10 Test case alias-preliminaries { Index: tests/destroy.test =================================================================== diff -u -rda6586782390b02ed7660b56417c3db00d63d1c3 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/destroy.test (.../destroy.test) (revision da6586782390b02ed7660b56417c3db00d63d1c3) +++ tests/destroy.test (.../destroy.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,8 +1,9 @@ # -*- Tcl -*- -package require nx; namespace import ::nx::* +package require nx ::nx::configure defaultMethodCallProtection false package require nx::test +namespace import ::nx::* Test parameter count 10 ::nsf::method::alias ::nx::Object set -frame object ::set Index: tests/forward.test =================================================================== diff -u -rb3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/forward.test (.../forward.test) (revision b3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b) +++ tests/forward.test (.../forward.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,6 +1,7 @@ # -*- Tcl -*- -package require nx; namespace import ::nx::* +package require nx package require nx::test +namespace import ::nx::* ########################################### # trivial object delegation Index: tests/info-method.test =================================================================== diff -u -raeb4c8b743c038290c9e15770669c6a50381a464 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/info-method.test (.../info-method.test) (revision aeb4c8b743c038290c9e15770669c6a50381a464) +++ tests/info-method.test (.../info-method.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -3,7 +3,7 @@ ::nx::configure defaultMethodCallProtection false package require nx::test -Test case base { +nx::Test case base { nx::Object create o { :alias set ::set } @@ -109,7 +109,7 @@ ::nx::configure defaultMethodCallProtection false } -Test case subobj { +nx::Test case subobj { ::nx::Object create o { ::nx::Object create [::nx::self]::sub { :method foo {} {;} @@ -122,7 +122,7 @@ ? {o info method type subal} "alias" } -Test case callable { +nx::Test case callable { # define the same method for Object and Class ::nx::Object method bar {} {return Object.bar} ::nx::Class method bar {} {return Class.bar} @@ -219,7 +219,7 @@ # # test info slots / info lookup slots # -Test case slots { +nx::Test case slots { nx::Class create C { :attribute a @@ -242,7 +242,7 @@ # # test info submethod and method handles for submethods # -Test case info-submethod { +nx::Test case info-submethod { nx::Object create o { :method "foo a" {} {return a} @@ -345,7 +345,7 @@ # # test "info methods -path" # -Test case info-methods-path { +nx::Test case info-methods-path { # # test case on base class # @@ -400,7 +400,7 @@ } -Test case parametersyntax { +nx::Test case parametersyntax { # a true method ? {::nx::Object info method parametersyntax method} "name arguments ?-returns value? body ?-precondition value? ?-postcondition value?" # a forwarder to ::nsf::relation; definition comes via ::nsf::parametersyntax Index: tests/method-require.test =================================================================== diff -u -r211c77c1a94a47be185a8bfb12c89512937b1901 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/method-require.test (.../method-require.test) (revision 211c77c1a94a47be185a8bfb12c89512937b1901) +++ tests/method-require.test (.../method-require.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -2,8 +2,8 @@ package require nx package require nx::test -Test parameter count 10 -Test case method-require { +nx::Test parameter count 10 +nx::Test case method-require { # # A few method-provides @@ -56,7 +56,7 @@ ? {C x} x } -Test case parent-require { +nx::Test case parent-require { ::nx::Class public class method __unknown {name} { #puts stderr "***** __unknown called with <$name>" ::nx::Object create $name @@ -82,7 +82,7 @@ # Test what happens if a class-specific method is registered and # called on an object. # -Test case method-require-scope { +nx::Test case method-require-scope { nx::Object create o ::nsf::method::require o alloc Index: tests/methods.test =================================================================== diff -u -rda6586782390b02ed7660b56417c3db00d63d1c3 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/methods.test (.../methods.test) (revision da6586782390b02ed7660b56417c3db00d63d1c3) +++ tests/methods.test (.../methods.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,7 +1,8 @@ # -*- Tcl -*- -package require nx; namespace import ::nx::* +package require nx ::nx::configure defaultMethodCallProtection false package require nx::test +namespace import ::nx::* Test parameter count 10 Index: tests/mixinof.test =================================================================== diff -u -r84c5ee62a46e8fab7b9cc481c87290d387baced9 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/mixinof.test (.../mixinof.test) (revision 84c5ee62a46e8fab7b9cc481c87290d387baced9) +++ tests/mixinof.test (.../mixinof.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,7 +1,9 @@ # -*- Tcl -*- # testing mixinof -package require nx; namespace import ::nx::* +package require nx package require nx::test +namespace import ::nx::* +Test parameter count 100 ########################################### # testing simple per object mixins Index: tests/returns.test =================================================================== diff -u -rb3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/returns.test (.../returns.test) (revision b3018d3be0f1524a3f1709edc0e2ddb5d8bc4c0b) +++ tests/returns.test (.../returns.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -11,8 +11,8 @@ # ::nsf::configure checkresult true -Test parameter count 10000 -Test case int-returns { +nx::Test parameter count 10000 +nx::Test case int-returns { nx::Class create C { # scripted method without paramdefs :method bar-ok1 {a b} {return 1} @@ -61,8 +61,8 @@ } -Test parameter count 10 -Test case app-specific-returns { +nx::Test parameter count 10 +nx::Test case app-specific-returns { ::nx::methodParameterSlot method type=range {name value arg} { foreach {min max} [split $arg -] break @@ -97,8 +97,8 @@ ? {c1 lappend l e1} {Value 'e1' of parameter return-value not between 1 and 30} } -Test parameter count 1000 -Test case converting-returns { +nx::Test parameter count 1000 +nx::Test case converting-returns { ::nx::methodParameterSlot method type=sex {name value args} { #puts stderr "[current] slot specific converter" @@ -153,8 +153,8 @@ # ::nsf::configure checkresults false -Test parameter count 1000 -Test case int-returns-nocheck { +::nx::Test parameter count 1000 +::nx::Test case int-returns-nocheck { nx::Class create C { # scripted method without paramdefs :method bar-ok1 {a b} {return 1} @@ -197,8 +197,8 @@ ? {::nsf::method::property ::nx::Object method returns} "" } -Test parameter count 10 -Test case app-specific-returns-nocheck { +::nx::Test parameter count 10 +::nx::Test case app-specific-returns-nocheck { ::nx::methodParameterSlot method type=range {name value arg} { foreach {min max} [split $arg -] break @@ -233,8 +233,8 @@ ? {c1 lappend l e1} e1 } -Test parameter count 1000 -Test case converting-returns-nocheck { +::nx::Test parameter count 1000 +::nx::Test case converting-returns-nocheck { ::nx::methodParameterSlot method type=sex {name value args} { #puts stderr "[current] slot specific converter" @@ -293,7 +293,7 @@ ::nsf::configure checkresults true -Test case int-returns-sugar { +::nx::Test case int-returns-sugar { nx::Class create C { # scripted method without paramdefs :method bar-ok1 {a b} -returns integer {return 1} @@ -352,7 +352,7 @@ } -Test case empty-paramdefs-robustedness { +::nx::Test case empty-paramdefs-robustedness { ::nx::Object create ku { # 1: Create an empty or checker-free parameter spec :method foo {} {;} Index: tests/submethods.test =================================================================== diff -u -r51d8ea8bcb98a7be32d4a2b626649a28902edb7f -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/submethods.test (.../submethods.test) (revision 51d8ea8bcb98a7be32d4a2b626649a28902edb7f) +++ tests/submethods.test (.../submethods.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -1,9 +1,10 @@ # -*- Tcl -*- package req nx -namespace import ::nx::* ::nx::configure defaultMethodCallProtection false package require nx::test +namespace import ::nx::* +Test parameter count 100 Test case submethods { #Object method unknown {} {} Object create o1 Index: tests/var-access.test =================================================================== diff -u -r65f8883a4596ea98365b7de1652700e3ac7394cc -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/var-access.test (.../var-access.test) (revision 65f8883a4596ea98365b7de1652700e3ac7394cc) +++ tests/var-access.test (.../var-access.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -17,8 +17,8 @@ :alias set ::nsf::var::set } -Test parameter count 10000 -Test case dummy { +nx::Test parameter count 10000 +nx::Test case dummy { nx::Object create o { set :x 1 } Index: tests/varresolution.test =================================================================== diff -u -rda6586782390b02ed7660b56417c3db00d63d1c3 -re02cb00ae815bd6f8561a6a03fceacc13fd91903 --- tests/varresolution.test (.../varresolution.test) (revision da6586782390b02ed7660b56417c3db00d63d1c3) +++ tests/varresolution.test (.../varresolution.test) (revision e02cb00ae815bd6f8561a6a03fceacc13fd91903) @@ -2,12 +2,11 @@ # # testing var resolution # -package require nx; namespace import ::nx::* +package require nx ::nx::configure defaultMethodCallProtection false package require nx::test +namespace import ::nx::* -Test parameter count 1 - ::nsf::method::alias ::nx::Object objeval -frame object ::eval ::nsf::method::alias ::nx::Object array -frame object ::array ::nsf::method::alias ::nx::Object lappend -frame object ::lappend