From: Jean Privat Date: Thu, 6 Aug 2015 18:34:40 +0000 (-0400) Subject: tests: update tests related to default arguments X-Git-Tag: v0.7.8~100^2 X-Git-Url: http://nitlanguage.org?hp=-c tests: update tests related to default arguments Signed-off-by: Jean Privat --- d472954f1a75654a895d0d272ade25e90c3e55d1 diff --git a/tests/base_arg_default.nit b/tests/base_arg_default.nit index 2d1af37..d4de4ed 100644 --- a/tests/base_arg_default.nit +++ b/tests/base_arg_default.nit @@ -80,8 +80,8 @@ var x #alt1#a.foo #alt1#a.foo(2) -a.foo(1,2) -a.foo(1,2,3) +#alt1#a.foo(1,2) +#alt1#a.foo(1,2,3) a.foo(1,2,3,4) a.foo(1,2,3,4,5) a.foo(1,2,3,4,5,6) diff --git a/tests/base_arg_default_autoinit.nit b/tests/base_arg_default_autoinit.nit index 6ea74cf..f5f4622 100644 --- a/tests/base_arg_default_autoinit.nit +++ b/tests/base_arg_default_autoinit.nit @@ -71,11 +71,11 @@ a.foo #alt1#a = new B(1) #alt1#a.foo -a = new B(1,4) -a.foo +#alt1#a = new B(1,4) +#alt1#a.foo -a = new B(1,2,4) -a.foo +#alt1#a = new B(1,2,4) +#alt1#a.foo a = new B(1,2,3,4) a.foo @@ -86,8 +86,8 @@ a.foo #alt1#a = new C(1) #alt1#a.foo -a = new C(4,1) -a.foo +#alt1#a = new C(4,1) +#alt1#a.foo a = new C(3,4,1) a.foo diff --git a/tests/base_arg_named.nit b/tests/base_arg_named.nit index a584add..e82ca07 100644 --- a/tests/base_arg_named.nit +++ b/tests/base_arg_named.nit @@ -15,9 +15,11 @@ import base_arg_default var a = new A +a.foo(a=1,b=2,c=3,d=4,e=5,f=6) a.foo(a=1,b=2,3,4,e=5,f=6) a.foo(f=6,3,e=5,b=2,4,a=1) -a.foo(3,e=5,b=2,4) +a.foo(f=6,d=4,e=5,b=2,c=3,a=1) +#alt1#a.foo(3,e=5,b=2,4) a.bar @@ -43,4 +45,3 @@ a.bar(b=2,a=1,c=3) #alt1#a.bar(2,a=1,3, 4) #alt1#a.bar(fail=1) #alt1#a.bar(a=1,a=1) -#alt1#a.foo(c=1,d=1) diff --git a/tests/base_arg_named_inherit.nit b/tests/base_arg_named_inherit.nit index 22f62f0..76d8ce1 100644 --- a/tests/base_arg_named_inherit.nit +++ b/tests/base_arg_named_inherit.nit @@ -26,9 +26,9 @@ end var a = new A #alt1# var a = new B a.foo(a=1,b=2,3,4,e=5,f=6) a.foo(f=6,3,e=5,b=2,4,a=1) -a.foo(3,e=5,b=2,4) +#alt3#a.foo(3,e=5,b=2,4) var b = new B #alt1# var b = new A b.foo(x=1,y=2,3,4,u=5,v=6) b.foo(v=6,3,u=5,y=2,4,x=1) -b.foo(3,u=5,y=2,4) +#alt3#b.foo(3,u=5,y=2,4) diff --git a/tests/base_arg_order.nit b/tests/base_arg_order.nit index a948eeb..9558e13 100644 --- a/tests/base_arg_order.nit +++ b/tests/base_arg_order.nit @@ -33,10 +33,10 @@ end var a = new A a.foo(order(1),order(2),order(3),order(4),order(5),order(6)) +a.foo(a=order(1),b=order(2),c=order(3),d=order(4),e=order(5),f=order(6)) a.foo(a=order(1),b=order(2),order(3),order(4),e=order(5),f=order(6)) a.foo(f=order(6),order(3),e=order(5),b=order(2),order(4),a=order(1)) -a.foo(order(3),e=order(5),b=order(2),order(4)) -a.foo(order(3),order(4)) +a.foo(f=order(6),d=order(4),e=order(5),b=order(2),c=order(3),a=order(1)) bar(order(1),order(2),order(3)) bar(order(1),order(2),order(3),order(4)) diff --git a/tests/sav/base_arg_default.res b/tests/sav/base_arg_default.res index 61ea614..56ee59c 100644 --- a/tests/sav/base_arg_default.res +++ b/tests/sav/base_arg_default.res @@ -1,17 +1,3 @@ - - -1 -2 - - -- -1 - -2 -3 - - -- 1 2 3 diff --git a/tests/sav/base_arg_default_alt1.res b/tests/sav/base_arg_default_alt1.res index fba2f2b..40dd13d 100644 --- a/tests/sav/base_arg_default_alt1.res +++ b/tests/sav/base_arg_default_alt1.res @@ -1,6 +1,8 @@ -alt/base_arg_default_alt1.nit:81,3--5: Error: expected at least 2 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 0. See introduction at `base_arg_default_alt1::A::foo`. -alt/base_arg_default_alt1.nit:82,3--5: Error: expected at least 2 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 1. See introduction at `base_arg_default_alt1::A::foo`. -alt/base_arg_default_alt1.nit:88,3--5: Error: expected at most 6 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 7. See introduction at `base_arg_default_alt1::A::foo`. -alt/base_arg_default_alt1.nit:94,3--5: Error: expected at most 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar`. -alt/base_arg_default_alt1.nit:99,3--5: Error: expected at most 3 argument(s) for `bar=(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar=`. -alt/base_arg_default_alt1.nit:110,1--13: Error: expected at most 3 argument(s) for `[]=(a: nullable Int, b: nullable Int, c: nullable Int): Int`; got 4. See introduction at `base_arg_default_alt1::A::[]=`. +alt/base_arg_default_alt1.nit:81,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 0. See introduction at `base_arg_default_alt1::A::foo`. +alt/base_arg_default_alt1.nit:82,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 1. See introduction at `base_arg_default_alt1::A::foo`. +alt/base_arg_default_alt1.nit:83,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 2. See introduction at `base_arg_default_alt1::A::foo`. +alt/base_arg_default_alt1.nit:84,3--5: Error: expected at least 4 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 3. See introduction at `base_arg_default_alt1::A::foo`. +alt/base_arg_default_alt1.nit:88,3--5: Error: expected 6 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 7. See introduction at `base_arg_default_alt1::A::foo`. +alt/base_arg_default_alt1.nit:94,3--5: Error: expected 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar`. +alt/base_arg_default_alt1.nit:99,3--5: Error: expected 3 argument(s) for `bar=(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default_alt1::A::bar=`. +alt/base_arg_default_alt1.nit:110,1--13: Error: expected 3 argument(s) for `[]=(a: nullable Int, b: nullable Int, c: nullable Int): Int`; got 4. See introduction at `base_arg_default_alt1::A::[]=`. diff --git a/tests/sav/base_arg_default_autoinit.res b/tests/sav/base_arg_default_autoinit.res index 437e8ee..289d97c 100644 --- a/tests/sav/base_arg_default_autoinit.res +++ b/tests/sav/base_arg_default_autoinit.res @@ -6,26 +6,11 @@ 2 - 1 - - -4 -- -1 -2 - -4 -- -1 2 3 4 - 1 - -4 -- -1 - 3 4 diff --git a/tests/sav/base_arg_default_autoinit_alt1.res b/tests/sav/base_arg_default_autoinit_alt1.res index cdf6690..ccec709 100644 --- a/tests/sav/base_arg_default_autoinit_alt1.res +++ b/tests/sav/base_arg_default_autoinit_alt1.res @@ -1,6 +1,9 @@ alt/base_arg_default_autoinit_alt1.nit:59,5--7: Error: expected at least 1 argument(s) for `init(mandatory: Int, optional: nullable Int)`; got 0. See introduction at `standard::Object::init`. -alt/base_arg_default_autoinit_alt1.nit:68,5--7: Error: expected at most 2 argument(s) for `init(mandatory: Int, optional: nullable Int)`; got 3. See introduction at `standard::Object::init`. -alt/base_arg_default_autoinit_alt1.nit:71,5--7: Error: expected at least 2 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 1. See introduction at `standard::Object::init`. -alt/base_arg_default_autoinit_alt1.nit:83,5--7: Error: expected at most 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 5. See introduction at `standard::Object::init`. -alt/base_arg_default_autoinit_alt1.nit:86,5--7: Error: expected at least 2 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 1. See introduction at `standard::Object::init`. -alt/base_arg_default_autoinit_alt1.nit:95,5--7: Error: expected at most 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 4. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:68,5--7: Error: expected 2 argument(s) for `init(mandatory: Int, optional: nullable Int)`; got 3. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:71,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 1. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:74,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 2. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:77,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 3. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:83,5--7: Error: expected 4 argument(s) for `init(mandatory: Int, optional: nullable Int, optional_b: nullable Int, mandatory_b: Int)`; got 5. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:86,5--7: Error: expected 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 1. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:89,5--7: Error: expected 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 2. See introduction at `standard::Object::init`. +alt/base_arg_default_autoinit_alt1.nit:95,5--7: Error: expected 3 argument(s) for `init(optional_b: nullable Int, mandatory_b: Int, mandatory: Int)`; got 4. See introduction at `standard::Object::init`. diff --git a/tests/sav/base_arg_named.res b/tests/sav/base_arg_named.res index be2e49f..f31da85 100644 --- a/tests/sav/base_arg_named.res +++ b/tests/sav/base_arg_named.res @@ -12,12 +12,19 @@ 5 6 - - +1 2 3 4 5 - +6 +- +1 +2 +3 +4 +5 +6 - diff --git a/tests/sav/base_arg_named_alt1.res b/tests/sav/base_arg_named_alt1.res index f41b60a..39b6ba4 100644 --- a/tests/sav/base_arg_named_alt1.res +++ b/tests/sav/base_arg_named_alt1.res @@ -1,4 +1,4 @@ -alt/base_arg_named_alt1.nit:43,3--5: Error: expected at most 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default::A::bar`. -alt/base_arg_named_alt1.nit:44,7--10: Error: no parameter `fail` for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`. -alt/base_arg_named_alt1.nit:45,11--13: Error: parameter `a` already associated with argument #0 for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`. -alt/base_arg_named_alt1.nit:46,7--9: Error: parameter `c` is not optional for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`. +alt/base_arg_named_alt1.nit:22,3--5: Error: expected at least 5 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 4. See introduction at `base_arg_default::A::foo`. +alt/base_arg_named_alt1.nit:45,3--5: Error: expected 3 argument(s) for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`; got 4. See introduction at `base_arg_default::A::bar`. +alt/base_arg_named_alt1.nit:46,7--10: Error: no parameter `fail` for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`. +alt/base_arg_named_alt1.nit:47,11--13: Error: parameter `a` already associated with argument #0 for `bar(a: nullable Int, b: nullable Int, c: nullable Int)`. diff --git a/tests/sav/base_arg_named_inherit.res b/tests/sav/base_arg_named_inherit.res index 17a46de..6be7ca2 100644 --- a/tests/sav/base_arg_named_inherit.res +++ b/tests/sav/base_arg_named_inherit.res @@ -12,13 +12,6 @@ 5 6 - - -2 -3 -4 -5 - -- 1 2 3 @@ -33,10 +26,3 @@ 5 6 - - -2 -3 -4 -5 - -- diff --git a/tests/sav/base_arg_named_inherit_alt1.res b/tests/sav/base_arg_named_inherit_alt1.res index aa69f50..20528d9 100644 --- a/tests/sav/base_arg_named_inherit_alt1.res +++ b/tests/sav/base_arg_named_inherit_alt1.res @@ -1,6 +1,4 @@ alt/base_arg_named_inherit_alt1.nit:27,7: Error: no parameter `a` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`. alt/base_arg_named_inherit_alt1.nit:28,7: Error: no parameter `f` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`. -alt/base_arg_named_inherit_alt1.nit:29,9: Error: no parameter `e` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`. alt/base_arg_named_inherit_alt1.nit:32,7: Error: no parameter `x` for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`. alt/base_arg_named_inherit_alt1.nit:33,7: Error: no parameter `v` for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`. -alt/base_arg_named_inherit_alt1.nit:34,9: Error: no parameter `u` for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`. diff --git a/tests/sav/base_arg_named_inherit_alt2.res b/tests/sav/base_arg_named_inherit_alt2.res index 2a85022..29bba0d 100644 --- a/tests/sav/base_arg_named_inherit_alt2.res +++ b/tests/sav/base_arg_named_inherit_alt2.res @@ -1,3 +1,2 @@ alt/base_arg_named_inherit_alt2.nit:27,7: Error: no parameter `a` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`. alt/base_arg_named_inherit_alt2.nit:28,7: Error: no parameter `f` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`. -alt/base_arg_named_inherit_alt2.nit:29,9: Error: no parameter `e` for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`. diff --git a/tests/sav/base_arg_named_inherit_alt3.res b/tests/sav/base_arg_named_inherit_alt3.res new file mode 100644 index 0000000..46dfc27 --- /dev/null +++ b/tests/sav/base_arg_named_inherit_alt3.res @@ -0,0 +1,2 @@ +alt/base_arg_named_inherit_alt3.nit:29,3--5: Error: expected at least 5 argument(s) for `foo(a: nullable Int, b: nullable Int, c: Int, d: Int, e: nullable Int, f: nullable Int)`; got 4. See introduction at `base_arg_default::A::foo`. +alt/base_arg_named_inherit_alt3.nit:34,3--5: Error: expected at least 5 argument(s) for `foo(x: nullable Int, y: nullable Int, z: Int, t: Int, u: nullable Int, v: nullable Int)`; got 4. See introduction at `base_arg_default::A::foo`. diff --git a/tests/sav/base_arg_order.res b/tests/sav/base_arg_order.res index b16bf3f..7ed6845 100644 --- a/tests/sav/base_arg_order.res +++ b/tests/sav/base_arg_order.res @@ -24,12 +24,12 @@ 5 6 - ->6 ->3 ->5 +>1 >2 +>3 >4 ->1 +>5 +>6 1 2 3 @@ -37,25 +37,31 @@ 5 6 - +>6 >3 >5 >2 >4 - +>1 +1 2 3 4 5 - +6 - ->3 +>6 >4 - - +>5 +>2 +>3 +>1 +1 +2 3 4 - - +5 +6 - >1 >2