From 615ca184408b334937c9ee4a7d169ad659f2510a Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Sat, 22 Sep 2018 10:42:55 +0200 Subject: [PATCH] tests: Add invalid "object creation" tests to increase coverage --- tests/Makefile.am | 4 ++++ tests/semantic/objectcreation-abstract-class.test | 8 ++++++++ tests/semantic/objectcreation-no-creation-method.test | 8 ++++++++ .../objectcreation-non-public-constructor.test | 10 ++++++++++ tests/semantic/objectcreation-unsupported-type.test | 9 +++++++++ 5 files changed, 39 insertions(+) create mode 100644 tests/semantic/objectcreation-abstract-class.test create mode 100644 tests/semantic/objectcreation-no-creation-method.test create mode 100644 tests/semantic/objectcreation-non-public-constructor.test create mode 100644 tests/semantic/objectcreation-unsupported-type.test diff --git a/tests/Makefile.am b/tests/Makefile.am index acbb59986..4cd23bb4b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -575,6 +575,10 @@ TESTS = \ semantic/method-too-many-type-arguments.test \ semantic/method-virtual.test \ semantic/method-virtual-body.test \ + semantic/objectcreation-abstract-class.test \ + semantic/objectcreation-no-creation-method.test \ + semantic/objectcreation-non-public-constructor.test \ + semantic/objectcreation-unsupported-type.test \ semantic/parameter-accessibility.test \ semantic/parameter-default-type.test \ semantic/parameter-out-default.test \ diff --git a/tests/semantic/objectcreation-abstract-class.test b/tests/semantic/objectcreation-abstract-class.test new file mode 100644 index 000000000..37234b5e5 --- /dev/null +++ b/tests/semantic/objectcreation-abstract-class.test @@ -0,0 +1,8 @@ +Invalid Code + +abstract class Foo { +} + +void main () { + var foo = new Foo (); +} diff --git a/tests/semantic/objectcreation-no-creation-method.test b/tests/semantic/objectcreation-no-creation-method.test new file mode 100644 index 000000000..17195fa31 --- /dev/null +++ b/tests/semantic/objectcreation-no-creation-method.test @@ -0,0 +1,8 @@ +Invalid Code + +void bar () { +} + +void main () { + var foo = new Foo.bar (); +} diff --git a/tests/semantic/objectcreation-non-public-constructor.test b/tests/semantic/objectcreation-non-public-constructor.test new file mode 100644 index 000000000..aa5ce3a57 --- /dev/null +++ b/tests/semantic/objectcreation-non-public-constructor.test @@ -0,0 +1,10 @@ +Invalid Code + +class Foo { + Foo () { + } +} + +void main () { + var foo = new Foo (); +} diff --git a/tests/semantic/objectcreation-unsupported-type.test b/tests/semantic/objectcreation-unsupported-type.test new file mode 100644 index 000000000..163f71c51 --- /dev/null +++ b/tests/semantic/objectcreation-unsupported-type.test @@ -0,0 +1,9 @@ +Invalid Code + +enum Bar { + NONE +} + +void main () { + var foo = new Bar (); +} -- 2.47.2