New tests base_init_auto and error_init_auto.
authorJean Privat <jean@pryen.org>
Mon, 26 Jan 2009 22:19:47 +0000 (17:19 -0500)
committerJean Privat <jean@pryen.org>
Mon, 26 Jan 2009 22:19:47 +0000 (17:19 -0500)
12 files changed:
tests/base_init_auto.nit [new file with mode: 0644]
tests/error_init_auto.nit [new file with mode: 0644]
tests/sav/base_init_auto.sav [new file with mode: 0644]
tests/sav/base_init_auto_alt1.sav [new file with mode: 0644]
tests/sav/base_init_auto_alt2.sav [new file with mode: 0644]
tests/sav/base_init_auto_alt3.sav [new file with mode: 0644]
tests/sav/base_init_auto_alt4.sav [new file with mode: 0644]
tests/sav/error_init_auto.sav [new file with mode: 0644]
tests/sav/error_init_auto_alt1.sav [new file with mode: 0644]
tests/sav/error_init_auto_alt2.sav [new file with mode: 0644]
tests/sav/error_init_auto_alt3.sav [new file with mode: 0644]
tests/sav/error_init_auto_alt4.sav [new file with mode: 0644]

diff --git a/tests/base_init_auto.nit b/tests/base_init_auto.nit
new file mode 100644 (file)
index 0000000..e1b8be9
--- /dev/null
@@ -0,0 +1,41 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 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
+       readable attr _x: Int #!alt1#
+       #alt1#readable attr _x: Int = 2
+       readable attr _y: Int = -2 #!alt2#
+       #alt2#readable attr _y: Int
+       #alt3#init (xx: Int) do _x = xx
+       #alt4#init foo(xx: Int) do _x = xx
+       meth work
+       do
+               _x.output
+               _y.output
+       end
+end
+
+var a: A
+a = new A(1)#!alt1##!alt2##!alt3##!alt4#
+#alt1#a = new A
+#alt2#a = new A(3, -3)
+#alt3#a = new A(4)
+#alt4#a = new A.foo(5)
+a.work
+
+
diff --git a/tests/error_init_auto.nit b/tests/error_init_auto.nit
new file mode 100644 (file)
index 0000000..2a913c5
--- /dev/null
@@ -0,0 +1,41 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2009 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
+       readable attr _x: Int #!alt1#
+       #alt1#readable attr _x: Int = 2
+       readable attr _y: Int = -2 #!alt2#
+       #alt2#readable attr _y: Int
+       #alt3#init (xx: Int) do _x = xx
+       #alt4#init foo(xx: Int) do _x = xx
+       meth work
+       do
+               _x.output
+               _y.output
+       end
+end
+
+var a: A
+a = new A
+a = new A(1)
+a = new A(2, 2)
+a = new A(3, 3, 3)
+a = new A.foo(5)
+a.work
+
+
diff --git a/tests/sav/base_init_auto.sav b/tests/sav/base_init_auto.sav
new file mode 100644 (file)
index 0000000..223767e
--- /dev/null
@@ -0,0 +1,2 @@
+1
+-2
diff --git a/tests/sav/base_init_auto_alt1.sav b/tests/sav/base_init_auto_alt1.sav
new file mode 100644 (file)
index 0000000..7e939e8
--- /dev/null
@@ -0,0 +1,2 @@
+2
+-2
diff --git a/tests/sav/base_init_auto_alt2.sav b/tests/sav/base_init_auto_alt2.sav
new file mode 100644 (file)
index 0000000..500e121
--- /dev/null
@@ -0,0 +1,2 @@
+3
+-3
diff --git a/tests/sav/base_init_auto_alt3.sav b/tests/sav/base_init_auto_alt3.sav
new file mode 100644 (file)
index 0000000..bc35029
--- /dev/null
@@ -0,0 +1,2 @@
+4
+-2
diff --git a/tests/sav/base_init_auto_alt4.sav b/tests/sav/base_init_auto_alt4.sav
new file mode 100644 (file)
index 0000000..ef25564
--- /dev/null
@@ -0,0 +1,2 @@
+5
+-2
diff --git a/tests/sav/error_init_auto.sav b/tests/sav/error_init_auto.sav
new file mode 100644 (file)
index 0000000..e12821e
--- /dev/null
@@ -0,0 +1,4 @@
+./error_init_auto.nit:34,5--9: Error: Method 'init' arity missmatch.
+./error_init_auto.nit:36,5--14: Error: Method 'init' arity missmatch.
+./error_init_auto.nit:37,5--17: Error: Method 'init' arity missmatch.
+./error_init_auto.nit:38,5--15: Error: Method 'foo' doesn't exists in A.
diff --git a/tests/sav/error_init_auto_alt1.sav b/tests/sav/error_init_auto_alt1.sav
new file mode 100644 (file)
index 0000000..09505e7
--- /dev/null
@@ -0,0 +1,4 @@
+alt/error_init_auto_alt1.nit:34,5--11: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt1.nit:35,5--14: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt1.nit:36,5--17: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt1.nit:37,5--15: Error: Method 'foo' doesn't exists in A.
diff --git a/tests/sav/error_init_auto_alt2.sav b/tests/sav/error_init_auto_alt2.sav
new file mode 100644 (file)
index 0000000..2cf402b
--- /dev/null
@@ -0,0 +1,4 @@
+alt/error_init_auto_alt2.nit:33,5--9: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt2.nit:34,5--11: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt2.nit:36,5--17: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt2.nit:37,5--15: Error: Method 'foo' doesn't exists in A.
diff --git a/tests/sav/error_init_auto_alt3.sav b/tests/sav/error_init_auto_alt3.sav
new file mode 100644 (file)
index 0000000..5ec28c2
--- /dev/null
@@ -0,0 +1,4 @@
+alt/error_init_auto_alt3.nit:34,5--9: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt3.nit:36,5--14: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt3.nit:37,5--17: Error: Method 'init' arity missmatch.
+alt/error_init_auto_alt3.nit:38,5--15: Error: Method 'foo' doesn't exists in A.
diff --git a/tests/sav/error_init_auto_alt4.sav b/tests/sav/error_init_auto_alt4.sav
new file mode 100644 (file)
index 0000000..d17504c
--- /dev/null
@@ -0,0 +1,4 @@
+alt/error_init_auto_alt4.nit:34,5--9: Error: Method 'init' doesn't exists in A.
+alt/error_init_auto_alt4.nit:35,5--11: Error: Method 'init' doesn't exists in A.
+alt/error_init_auto_alt4.nit:36,5--14: Error: Method 'init' doesn't exists in A.
+alt/error_init_auto_alt4.nit:37,5--17: Error: Method 'init' doesn't exists in A.