tests: add base_arg_named_inherit.nit
authorJean Privat <jean@pryen.org>
Sat, 18 Apr 2015 15:12:11 +0000 (22:12 +0700)
committerJean Privat <jean@pryen.org>
Sat, 25 Apr 2015 02:15:51 +0000 (09:15 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_arg_named_inherit.nit [new file with mode: 0644]
tests/sav/base_arg_named_inherit.res [new file with mode: 0644]
tests/sav/base_arg_named_inherit_alt1.res [new file with mode: 0644]
tests/sav/base_arg_named_inherit_alt2.res [new file with mode: 0644]

diff --git a/tests/base_arg_named_inherit.nit b/tests/base_arg_named_inherit.nit
new file mode 100644 (file)
index 0000000..22f62f0
--- /dev/null
@@ -0,0 +1,34 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import base_arg_default
+
+class B
+       super A
+       redef fun foo(x,y,z,t,u,v) do super
+end
+
+#alt2#redef class A
+#alt2# redef fun foo(x,y,z,t,u,v) do super
+#alt2#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)
+
+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)
diff --git a/tests/sav/base_arg_named_inherit.res b/tests/sav/base_arg_named_inherit.res
new file mode 100644 (file)
index 0000000..17a46de
--- /dev/null
@@ -0,0 +1,42 @@
+1
+2
+3
+4
+5
+6
+-
+1
+2
+3
+4
+5
+6
+-
+
+2
+3
+4
+5
+
+-
+1
+2
+3
+4
+5
+6
+-
+1
+2
+3
+4
+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
new file mode 100644 (file)
index 0000000..aa69f50
--- /dev/null
@@ -0,0 +1,6 @@
+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
new file mode 100644 (file)
index 0000000..2a85022
--- /dev/null
@@ -0,0 +1,3 @@
+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)`.