tests: add more bast_attr_init_val*
authorJean Privat <jean@pryen.org>
Mon, 5 Aug 2013 18:32:03 +0000 (14:32 -0400)
committerJean Privat <jean@pryen.org>
Mon, 5 Aug 2013 18:32:03 +0000 (14:32 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_attr_init_val_inh_raf.nit [new file with mode: 0644]
tests/base_attr_init_val_raf2.nit [new file with mode: 0644]
tests/base_attr_init_val_raf3.nit [new file with mode: 0644]
tests/sav/base_attr_init_val_inh_raf.res [new file with mode: 0644]
tests/sav/base_attr_init_val_raf2.res [new file with mode: 0644]
tests/sav/base_attr_init_val_raf3.res [new file with mode: 0644]

diff --git a/tests/base_attr_init_val_inh_raf.nit b/tests/base_attr_init_val_inh_raf.nit
new file mode 100644 (file)
index 0000000..17621c4
--- /dev/null
@@ -0,0 +1,48 @@
+# 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_attr_init_val_inh
+
+redef class A
+       var aa1 = new W(3)
+       var aa2: W = a1
+       var aa3: W = aa1
+end
+
+redef class B
+       super A
+       var bb1 = new W(4)
+       var bb2: W = b1
+       var bb3: W = a1
+       var bb4: W = bb1
+       var bb5: W = aa1
+end
+
+var test1 = new A
+test1.aa1.v.output
+test1.aa2.v.output
+test1.aa3.v.output
+
+'\n'.output
+
+var test2 = new B
+test2.aa1.v.output
+test2.aa2.v.output
+test2.aa3.v.output
+test2.bb1.v.output
+test2.bb2.v.output
+test2.bb3.v.output
+test2.bb4.v.output
+test2.bb5.v.output
+
diff --git a/tests/base_attr_init_val_raf2.nit b/tests/base_attr_init_val_raf2.nit
new file mode 100644 (file)
index 0000000..a240c15
--- /dev/null
@@ -0,0 +1,22 @@
+# 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_attr_init_val1
+
+redef class A
+       var k: Int = i + 3
+end
+
+var a = new A
+a.k.output
diff --git a/tests/base_attr_init_val_raf3.nit b/tests/base_attr_init_val_raf3.nit
new file mode 100644 (file)
index 0000000..fdfd843
--- /dev/null
@@ -0,0 +1,23 @@
+# 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_attr_init_val_raf
+import base_attr_init_val_raf2
+
+redef class A
+       var l: Int = i + j * 10 + k * 100
+end
+
+var a = new A
+a.l.output
diff --git a/tests/sav/base_attr_init_val_inh_raf.res b/tests/sav/base_attr_init_val_inh_raf.res
new file mode 100644 (file)
index 0000000..4c8962b
--- /dev/null
@@ -0,0 +1,12 @@
+3
+1
+3
+
+3
+1
+3
+4
+2
+1
+4
+3
diff --git a/tests/sav/base_attr_init_val_raf2.res b/tests/sav/base_attr_init_val_raf2.res
new file mode 100644 (file)
index 0000000..b8626c4
--- /dev/null
@@ -0,0 +1 @@
+4
diff --git a/tests/sav/base_attr_init_val_raf3.res b/tests/sav/base_attr_init_val_raf3.res
new file mode 100644 (file)
index 0000000..1bb7ac5
--- /dev/null
@@ -0,0 +1 @@
+421