From 62e69c94afcafc02c24b8b9a39cbe04d2f7186be Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Thu, 1 Apr 2021 15:17:51 +0200 Subject: [PATCH] :white_check_mark: Class extensions (add tests) --- tests/extend/extend.gw | 8 ++++++++ tests/extend/extend_abstract.gw | 4 ++++ tests/extend/extend_final.gw | 6 ++++++ tests/extend/extend_not_compound.gw | 4 ++++ tests/extend/extend_tmpl.gw | 8 ++++++++ 5 files changed, 30 insertions(+) create mode 100644 tests/extend/extend.gw create mode 100644 tests/extend/extend_abstract.gw create mode 100644 tests/extend/extend_final.gw create mode 100644 tests/extend/extend_not_compound.gw create mode 100644 tests/extend/extend_tmpl.gw diff --git a/tests/extend/extend.gw b/tests/extend/extend.gw new file mode 100644 index 00000000..b917796c --- /dev/null +++ b/tests/extend/extend.gw @@ -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 index 00000000..7397ed86 --- /dev/null +++ b/tests/extend/extend_abstract.gw @@ -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 index 00000000..0b5dfdc3 --- /dev/null +++ b/tests/extend/extend_final.gw @@ -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 index 00000000..8c492697 --- /dev/null +++ b/tests/extend/extend_not_compound.gw @@ -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 index 00000000..84e990a9 --- /dev/null +++ b/tests/extend/extend_tmpl.gw @@ -0,0 +1,8 @@ +class C:[A] {} + +extends C:[int] { + fun void test() { <<< __func__ >>>; } +} + +const C:[int] c; +c.test(); -- 2.43.0