tests: add base_attr_abstract[34].nit
authorJean Privat <jean@pryen.org>
Wed, 3 Jun 2015 14:24:41 +0000 (10:24 -0400)
committerJean Privat <jean@pryen.org>
Tue, 9 Jun 2015 00:50:35 +0000 (20:50 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

tests/base_attr_abstract3.nit [new file with mode: 0644]
tests/base_attr_abstract4.nit [new file with mode: 0644]
tests/sav/base_attr_abstract3.res [new file with mode: 0644]
tests/sav/base_attr_abstract4.res [new file with mode: 0644]

diff --git a/tests/base_attr_abstract3.nit b/tests/base_attr_abstract3.nit
new file mode 100644 (file)
index 0000000..d67a45f
--- /dev/null
@@ -0,0 +1,76 @@
+# 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
+
+interface A
+       var i: Int is abstract, autoinit
+       fun j: Int is abstract, autoinit
+       fun j=(o: Int) is abstract, autoinit
+end
+
+class B
+       super A
+       var k: Int is abstract, autoinit
+       fun l: Int is abstract, autoinit
+       fun l=(o: Int) is abstract, autoinit
+end
+
+class C
+       super B
+       redef fun i do
+               'i'.output
+               return 1
+       end
+       redef fun i=(o) do
+               'i'.output
+               '='.output
+               o.output
+       end
+       redef fun j do
+               'j'.output
+               return 2
+       end
+       redef fun j=(o) do
+               'j'.output
+               '='.output
+               o.output
+       end
+       redef fun k do
+               'k'.output
+               return 3
+       end
+       redef fun k=(o)
+       do
+               'k'.output
+               '='.output
+               o.output
+       end
+       redef fun l do
+               'l'.output
+               return 4
+       end
+       redef fun l=(o) do
+               'l'.output
+               '='.output
+               o.output
+       end
+end
+
+var c = new C(10,20,30,40)
+'\n'.output
+c.i.output
+c.j.output
+c.k.output
+c.l.output
diff --git a/tests/base_attr_abstract4.nit b/tests/base_attr_abstract4.nit
new file mode 100644 (file)
index 0000000..876b85a
--- /dev/null
@@ -0,0 +1,75 @@
+# 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
+
+interface A
+       var i: Int is abstract
+       fun j: Int is abstract
+       fun j=(o: Int) is abstract
+end
+
+class B
+       super A
+       var k: Int is abstract
+       fun l: Int is abstract
+       fun l=(o: Int) is abstract
+end
+
+class C
+       super B
+       redef fun i do
+               'i'.output
+               return 1
+       end
+       redef fun i=(o) do
+               'i'.output
+               '='.output
+               o.output
+       end
+       redef fun j do
+               'j'.output
+               return 2
+       end
+       redef fun j=(o) do
+               'j'.output
+               '='.output
+               o.output
+       end
+       redef fun k do
+               'k'.output
+               return 3
+       end
+       redef fun k=(o)
+       do
+               'k'.output
+               '='.output
+               o.output
+       end
+       redef fun l do
+               'l'.output
+               return 4
+       end
+       redef fun l=(o) do
+               'l'.output
+               '='.output
+               o.output
+       end
+end
+
+var c = new C
+c.i.output
+c.j.output
+c.k.output
+c.l.output
diff --git a/tests/sav/base_attr_abstract3.res b/tests/sav/base_attr_abstract3.res
new file mode 100644 (file)
index 0000000..d328d13
--- /dev/null
@@ -0,0 +1,9 @@
+i=10
+jj=20
+k=30
+ll=40
+
+i1
+j2
+k3
+l4
diff --git a/tests/sav/base_attr_abstract4.res b/tests/sav/base_attr_abstract4.res
new file mode 100644 (file)
index 0000000..4d4bee4
--- /dev/null
@@ -0,0 +1,4 @@
+i1
+j2
+k3
+l4