]> Nishi Git Mirror - gwion.git/commitdiff
:white_check_mark: Class extensions (add tests)
authorJérémie Astor <fennecdjay@gmail.com>
Thu, 1 Apr 2021 13:17:51 +0000 (15:17 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Thu, 1 Apr 2021 13:17:51 +0000 (15:17 +0200)
tests/extend/extend.gw [new file with mode: 0644]
tests/extend/extend_abstract.gw [new file with mode: 0644]
tests/extend/extend_final.gw [new file with mode: 0644]
tests/extend/extend_not_compound.gw [new file with mode: 0644]
tests/extend/extend_tmpl.gw [new file with mode: 0644]

diff --git a/tests/extend/extend.gw b/tests/extend/extend.gw
new file mode 100644 (file)
index 0000000..b917796
--- /dev/null
@@ -0,0 +1,8 @@
+class C {}
+
+extends C {
+  fun void test() { <<< __func__ >>>; }
+}
+
+const C c;
+c.test();
diff --git a/tests/extend/extend_abstract.gw b/tests/extend/extend_abstract.gw
new file mode 100644 (file)
index 0000000..7397ed8
--- /dev/null
@@ -0,0 +1,4 @@
+#! [contains] abstract functions in extends
+extends Event {
+  fun void test();
+}
diff --git a/tests/extend/extend_final.gw b/tests/extend/extend_final.gw
new file mode 100644 (file)
index 0000000..0b5dfdc
--- /dev/null
@@ -0,0 +1,6 @@
+#! [contains] extend final type
+class final C {}
+
+extends C {
+  fun void test() {}
+}
diff --git a/tests/extend/extend_not_compound.gw b/tests/extend/extend_not_compound.gw
new file mode 100644 (file)
index 0000000..8c49269
--- /dev/null
@@ -0,0 +1,4 @@
+#! [contains] only compound types can be extended
+extends int {
+  fun void test(){}
+}
diff --git a/tests/extend/extend_tmpl.gw b/tests/extend/extend_tmpl.gw
new file mode 100644 (file)
index 0000000..84e990a
--- /dev/null
@@ -0,0 +1,8 @@
+class C:[A] {}
+
+extends C:[int] {
+  fun void test() { <<< __func__ >>>; }
+}
+
+const C:[int] c;
+c.test();