tests: add tests for top-level redefinitions
authorJean Privat <jean@pryen.org>
Tue, 10 Jun 2014 18:56:48 +0000 (14:56 -0400)
committerJean Privat <jean@pryen.org>
Tue, 10 Jun 2014 21:15:20 +0000 (17:15 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/error_defs2.nit [new file with mode: 0644]
tests/sav/error_defs2.res [new file with mode: 0644]
tests/sav/error_defs2_alt1.res [new file with mode: 0644]
tests/sav/error_defs2_alt2.res [new file with mode: 0644]
tests/sav/error_defs_alt4.res
tests/sav/error_defs_alt5.res

diff --git a/tests/error_defs2.nit b/tests/error_defs2.nit
new file mode 100644 (file)
index 0000000..aa28df4
--- /dev/null
@@ -0,0 +1,21 @@
+# 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 error_defs
+
+redef fun baz: Int do return 4
+#alt1# redef fun bar: Int do return 40
+#alt2# redef fun foo: Int do return 400
diff --git a/tests/sav/error_defs2.res b/tests/sav/error_defs2.res
new file mode 100644 (file)
index 0000000..354a0e6
--- /dev/null
@@ -0,0 +1,3 @@
+4
+14
+124
diff --git a/tests/sav/error_defs2_alt1.res b/tests/sav/error_defs2_alt1.res
new file mode 100644 (file)
index 0000000..c79fb13
--- /dev/null
@@ -0,0 +1 @@
+alt/error_defs2_alt1.nit:20,11--13: Error: bar is not a top level method.
diff --git a/tests/sav/error_defs2_alt2.res b/tests/sav/error_defs2_alt2.res
new file mode 100644 (file)
index 0000000..8b01fd5
--- /dev/null
@@ -0,0 +1 @@
+alt/error_defs2_alt2.nit:21,11--13: Error: No property Object::foo is inherited. Remove the redef keyword to define a new property.
index 2e24837..80e2677 100644 (file)
@@ -1 +1 @@
-alt/error_defs_alt4.nit:29,5--7: Redef error: A::baz is an inherited property. To redefine it, add the redef keyword.
+alt/error_defs_alt4.nit:29,5--7: Error: baz is a top level method.
index 7732d68..fec299a 100644 (file)
@@ -1 +1 @@
-alt/error_defs_alt5.nit:30,14--22: Redef error: error_defs_alt5#A#baz redefines error_defs_alt5#Object#baz with 1 parameter(s), 0 expected. Signature is error_defs_alt5#A#baz: Int
+alt/error_defs_alt5.nit:30,11--13: Error: baz is a top level method.