Index: tests/parameters.test =================================================================== diff -u -rcd96543a3a6fb25ec8e52548892d12d244208a1a -rcc94b154709f9bd3393fbbdb9af982a30b57dee0 --- tests/parameters.test (.../parameters.test) (revision cd96543a3a6fb25ec8e52548892d12d244208a1a) +++ tests/parameters.test (.../parameters.test) (revision cc94b154709f9bd3393fbbdb9af982a30b57dee0) @@ -99,10 +99,10 @@ ? {::nsf::is -complain class o1} {expected class but got "o1" for parameter "value"} ? {::nsf::is class o1} 0 ? {::nsf::is -complain class Test} 1 - ? {::nsf::is -complain object,multivalued [list o1 Test]} 1 + ? {::nsf::is -complain object,1..* [list o1 Test]} 1 - ? {::nsf::is -complain integer,multivalued [list 1 2 3]} 1 - ? {::nsf::is -complain integer,multivalued [list 1 2 3 a]} \ + ? {::nsf::is -complain integer,1..* [list 1 2 3]} 1 + ? {::nsf::is -complain integer,1..* [list 1 2 3 a]} \ {invalid value in "1 2 3 a": expected integer but got "a" for parameter "value"} ? {::nsf::is -complain object,type=::C c1} 1 ? {::nsf::is -complain object,type=::C o} \ @@ -413,7 +413,7 @@ D create d1 Object create o - D public method foo {m:integer,multivalued} { + D public method foo {m:integer,0..n} { return $m } ? {d1 foo ""} "" "emtpy list" @@ -423,7 +423,7 @@ {invalid value in "1 a 2": expected integer but got "a" for parameter "m"} \ "multiple values with wrong value" - D public method foo {m:object,multivalued} { + D public method foo {m:object,0..n} { return $m } ? {d1 foo ""} "" "emtpy list" @@ -433,7 +433,7 @@ "multiple values" Class create Foo -attributes { - {ints:integer,multivalued} + {ints:integer,1..*} } ? {Foo create foo -ints {1 2}} "::foo" ? {Foo create foo -ints {1 a 2}} {invalid value in "1 a 2": expected integer but got "a" for parameter "-ints"} @@ -562,7 +562,7 @@ "query instparams with default, no paramdefs needed" ? {Class info method parameter method} \ - "name arguments:parameter,multivalued -returns body -precondition -postcondition" \ + "name arguments:parameter,0..* -returns body -precondition -postcondition" \ "query instparams for scripted method 'method'" ? {Object info method parameter ::nsf::forward} \ @@ -746,7 +746,7 @@ :public method baz {{x:integer,substdefault ${:y}}} { return $x } - :public method boz {{x:integer,multivalued,substdefault ${:z}}} { + :public method boz {{x:integer,0..n,substdefault ${:z}}} { return $x } } @@ -838,8 +838,8 @@ m:metaclass b:baseclass u:upper - us:upper,multivalued - {x:object,multivalued {o}} + us:upper,1..* + {x:object,1..* {o}} } # TODO: we have no good interface for querying the slot notation for parameters @@ -855,9 +855,9 @@ ? {::parameterFromSlot ParamTest d} "d:object,type=::C,slot=::ParamTest::slot::d" ? {::parameterFromSlot ParamTest d1} "d1:object,type=::C,slot=::ParamTest::slot::d1" #? {::parameterFromSlot ParamTest mix} "mix:hasmixin,arg=M,slot=::ParamTest::slot::mix" - ? {::parameterFromSlot ParamTest x} "x:object,multivalued,slot=::ParamTest::slot::x o" + ? {::parameterFromSlot ParamTest x} "x:object,1..*,slot=::ParamTest::slot::x o" ? {::parameterFromSlot ParamTest u} "u:upper,slot=::ParamTest::slot::u" - ? {::parameterFromSlot ParamTest us} "us:upper,multivalued,slot=::ParamTest::slot::us" + ? {::parameterFromSlot ParamTest us} "us:upper,1..*,slot=::ParamTest::slot::us" ? {ParamTest create p -o o} ::p ? {ParamTest create p -o xxx} \ @@ -941,8 +941,8 @@ } } Class create C { - :public method foo {s:sex,multivalued,convert} {return $s} - :public method bar {s:sex,multivalued} {return $s} + :public method foo {s:sex,0..*,convert} {return $s} + :public method bar {s:sex,0..*} {return $s} } C create c1 ? {c1 foo {male female mann frau}} "m f m f" @@ -956,11 +956,11 @@ # Note that this converter does NOT return a value; it converts all # values into emtpy strings. } - ? {::nsf::is -complain mType,slot=::tmpObj,multivalued {1 0}} \ + ? {::nsf::is -complain mType,slot=::tmpObj,0..* {1 0}} \ {invalid value in "1 0": expected false but got 1} \ "fail on first value" - ? {::nsf::is -complain mType,slot=::tmpObj,multivalued {0 0 0}} 1 "all pass" - ? {::nsf::is -complain mType,slot=::tmpObj,multivalued {0 1}} \ + ? {::nsf::is -complain mType,slot=::tmpObj,0..* {0 0 0}} 1 "all pass" + ? {::nsf::is -complain mType,slot=::tmpObj,0..* {0 1}} \ {invalid value in "0 1": expected false but got 1} \ "fail o last value" } @@ -995,23 +995,24 @@ Object create o3 Object create o { - :public method foo {x:integer,allowempty y:integer os:object,multivalued,allowempty} { + :public method foo {x:integer,0..1 y:integer os:object,0..*} { return $x } } ? {o foo 1 2 {o1 o2}} 1 "all values specified" ? {o foo "" 2 {o1 o2}} "" "first is empty" ? {o foo 1 "" {o1 o2}} {expected integer but got "" for parameter "y"} "second is empty" - ? {o foo 1 2 {}} 1 "empty list, does not require allowempty" + ? {o foo 1 2 {}} 1 "empty list" ? {o foo 1 2 {o1 "" o2}} 1 "list contains empty value" - ? {o info method parameter foo} "x:integer,allowempty y:integer os:object,multivalued,allowempty" + ? {o info method parameter foo} "x:integer,0..1 y:integer os:object,0..*" - o public method foo {x:integer,allowempty y:integer os:object,multivalued} {return $x} + o public method foo {x:integer,0..1 y:integer os:object,1..*} {return $x} ? {o foo 1 2 {o1 "" o2}} {invalid value in "o1 "" o2": expected object but got "" for parameter "os"} \ "list contains empty value" - + ? {o foo "" 2 {}} {invalid parameter value: list is not allowed to be empty} \ + "empty int, empty list of objects" } ####################################################### # slot specific converter @@ -1057,12 +1058,12 @@ ? {o a 1} "1" ? {::nsf::setter o a:integer} "::o::a" - ? {::nsf::setter o ints:integer,multivalued} "::o::ints" + ? {::nsf::setter o ints:integer,1..*} "::o::ints" ? {::nsf::setter o o:object} "::o::o" ? {o info method handle ints} "::o::ints" - ? {o info method definition ints} "::o public setter ints:integer,multivalued" - ? {o info method parameter ints} "ints:integer,multivalued" + ? {o info method definition ints} "::o public setter ints:integer,1..*" + ? {o info method parameter ints} "ints:integer,1..*" ? {o info method args ints} "ints" ? {o info method handle o} "::o::o" @@ -1124,7 +1125,7 @@ :public method noarg {} {return ""} :public method onearg {x} {return $x} :public method intarg {x:integer} {return $x} - :public method intsarg {x:integer,multivalued} {return $x} + :public method intsarg {x:integer,1..*} {return $x} :public method boolarg {x:boolean} {return $x} :public method classarg {x:class} {return $x} :public method upperarg {x:upper} {return $x} @@ -1200,7 +1201,7 @@ :public method noarg {} {return ""} :public method onearg {x} {return $x} :public method intarg {x:integer} {return $x} - :public method intsarg {x:integer,multivalued} {return $x} + :public method intsarg {x:integer,1..*} {return $x} :public method boolarg {x:boolean} {return $x} :public method classarg {x:class} {return $x} :public method upperarg {x:upper} {return $x} @@ -1302,7 +1303,7 @@ :method noarg {} {return ""} :method onearg {-x} {return $x} :method intarg {-x:integer} {return $x} - :method intsarg {-x:integer,multivalued} {return $x} + :method intsarg {-x:integer,1..*} {return $x} :method boolarg {-x:boolean} {return $x} :method classarg {-x:class} {return $x} :method upperarg {-x:upper} {return $x}