tests: add base_attr_annot.nit
authorJean Privat <jean@pryen.org>
Wed, 3 Jun 2015 15:23:39 +0000 (11:23 -0400)
committerJean Privat <jean@pryen.org>
Tue, 9 Jun 2015 00:50:41 +0000 (20:50 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

18 files changed:
tests/base_attr_annot.nit [new file with mode: 0644]
tests/sav/base_attr_annot.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt1.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt2.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt3.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt4.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt5.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt6.res [new file with mode: 0644]
tests/sav/base_attr_annot_1alt1_alt7.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt1.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt2.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt3.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt4.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt5.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt6.res [new file with mode: 0644]
tests/sav/base_attr_annot_alt7.res [new file with mode: 0644]
tests/sav/niti/base_attr_annot_alt2.res [new file with mode: 0644]

diff --git a/tests/base_attr_annot.nit b/tests/base_attr_annot.nit
new file mode 100644 (file)
index 0000000..17f7076
--- /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 standard::kernel
+
+class A
+       var a: Object is
+               #alt2# noautoinit
+               #alt3# autoinit
+               #alt4# lazy
+               #alt5# readonly
+               #alt6# abstract
+               #alt7# lateinit
+               writable
+       end #1alt1# do return 1
+end
+
+class B
+       super A
+end
+
+var b = new B(1) #alt1,2,4,5,6,7# var b = new B
+b.a.output
diff --git a/tests/sav/base_attr_annot.res b/tests/sav/base_attr_annot.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1.res b/tests/sav/base_attr_annot_1alt1.res
new file mode 100644 (file)
index 0000000..4cd5256
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1.nit:33,9--11: Error: expected 0 argument(s) for `init`; got 1. See introduction at `standard::Object::init`.
diff --git a/tests/sav/base_attr_annot_1alt1_alt1.res b/tests/sav/base_attr_annot_1alt1_alt1.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1_alt2.res b/tests/sav/base_attr_annot_1alt1_alt2.res
new file mode 100644 (file)
index 0000000..225f15c
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1_alt2.nit:19,3--12: Error: `noautoinit` attributes cannot have an initial value.
diff --git a/tests/sav/base_attr_annot_1alt1_alt3.res b/tests/sav/base_attr_annot_1alt1_alt3.res
new file mode 100644 (file)
index 0000000..dac6bc0
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1_alt3.nit:19,3--20,10: Error: `autoinit` attributes cannot have an initial value.
diff --git a/tests/sav/base_attr_annot_1alt1_alt4.res b/tests/sav/base_attr_annot_1alt1_alt4.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1_alt5.res b/tests/sav/base_attr_annot_1alt1_alt5.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_1alt1_alt6.res b/tests/sav/base_attr_annot_1alt1_alt6.res
new file mode 100644 (file)
index 0000000..0bd4036
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_1alt1_alt6.nit:19,3--23,10: Error: `abstract` attributes cannot have an initial value.
diff --git a/tests/sav/base_attr_annot_1alt1_alt7.res b/tests/sav/base_attr_annot_1alt1_alt7.res
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/tests/sav/base_attr_annot_alt1.res b/tests/sav/base_attr_annot_alt1.res
new file mode 100644 (file)
index 0000000..0b649c6
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt1.nit:33,9--11: Error: expected 1 argument(s) for `init(a: Object)`; got 0. See introduction at `standard::Object::init`.
diff --git a/tests/sav/base_attr_annot_alt2.res b/tests/sav/base_attr_annot_alt2.res
new file mode 100644 (file)
index 0000000..1211ed7
--- /dev/null
@@ -0,0 +1 @@
+Runtime error: Uninitialized attribute _a (alt/base_attr_annot_alt2.nit:18)
diff --git a/tests/sav/base_attr_annot_alt3.res b/tests/sav/base_attr_annot_alt3.res
new file mode 100644 (file)
index 0000000..fdf9917
--- /dev/null
@@ -0,0 +1,2 @@
+alt/base_attr_annot_alt3.nit:19,3--20,10: Warning: superfluous `autoinit` on attribute.
+1
diff --git a/tests/sav/base_attr_annot_alt4.res b/tests/sav/base_attr_annot_alt4.res
new file mode 100644 (file)
index 0000000..c1a929e
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt4.nit:19,3--21,6: Error: `lazy` attributes need a value.
diff --git a/tests/sav/base_attr_annot_alt5.res b/tests/sav/base_attr_annot_alt5.res
new file mode 100644 (file)
index 0000000..21b6b60
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt5.nit:19,3--22,10: Error: `readonly` attributes need a value.
diff --git a/tests/sav/base_attr_annot_alt6.res b/tests/sav/base_attr_annot_alt6.res
new file mode 100644 (file)
index 0000000..a594cce
--- /dev/null
@@ -0,0 +1 @@
+Runtime error: Abstract method `a` called on `B` (alt/base_attr_annot_alt6.nit:18)
diff --git a/tests/sav/base_attr_annot_alt7.res b/tests/sav/base_attr_annot_alt7.res
new file mode 100644 (file)
index 0000000..75208d1
--- /dev/null
@@ -0,0 +1 @@
+alt/base_attr_annot_alt7.nit:19,3--24,10: Error: `lateinit` attributes need a value.
diff --git a/tests/sav/niti/base_attr_annot_alt2.res b/tests/sav/niti/base_attr_annot_alt2.res
new file mode 100644 (file)
index 0000000..f51ab75
--- /dev/null
@@ -0,0 +1 @@
+Runtime error: Uninitialized attribute _a (alt/base_attr_annot_alt2.nit:34)