tests: add base_init_inherit6.nit
authorJean Privat <jean@pryen.org>
Tue, 23 Apr 2013 06:51:28 +0000 (02:51 -0400)
committerJean Privat <jean@pryen.org>
Tue, 23 Apr 2013 06:51:28 +0000 (02:51 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_init_inherit6.nit [new file with mode: 0644]
tests/sav/base_init_inherit6.res [new file with mode: 0644]
tests/sav/base_init_inherit6_alt1.res [new file with mode: 0644]
tests/sav/base_init_inherit6_alt2.res [new file with mode: 0644]

diff --git a/tests/base_init_inherit6.nit b/tests/base_init_inherit6.nit
new file mode 100644 (file)
index 0000000..5e05b7d
--- /dev/null
@@ -0,0 +1,33 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2008 Jean Privat <jean@pryen.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 kernel
+
+class A
+       init do 1.output
+       init foo do 2.output
+end
+
+class B
+       super A
+       init bar do 3.output
+end
+
+var a = new A
+var a2 = new A.foo
+var b = new B.bar
+#alt1#var b2 = new B
+#alt2#var b3 = new B.foo
diff --git a/tests/sav/base_init_inherit6.res b/tests/sav/base_init_inherit6.res
new file mode 100644 (file)
index 0000000..66ac4a9
--- /dev/null
@@ -0,0 +1,4 @@
+1
+2
+1
+3
diff --git a/tests/sav/base_init_inherit6_alt1.res b/tests/sav/base_init_inherit6_alt1.res
new file mode 100644 (file)
index 0000000..893493f
--- /dev/null
@@ -0,0 +1 @@
+alt/base_init_inherit6_alt1.nit:32,10--14: Error: init is not a constructor in B.
diff --git a/tests/sav/base_init_inherit6_alt2.res b/tests/sav/base_init_inherit6_alt2.res
new file mode 100644 (file)
index 0000000..900503c
--- /dev/null
@@ -0,0 +1 @@
+alt/base_init_inherit6_alt2.nit:33,10--18: Error: foo is not a constructor in B.