[vala/wip/tests] tests: Add invalid "control-semantic" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/tests] tests: Add invalid "control-semantic" tests to increase coverage
- Date: Mon, 5 Feb 2018 13:02:10 +0000 (UTC)
commit 117040095ee28b1374e54f0212a2886ef38aa104
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Feb 5 13:37:04 2018 +0100
tests: Add invalid "control-semantic" tests to increase coverage
tests/Makefile.am | 19 +++++++++++++++++++
tests/control-semantic/argument-extra.test | 8 ++++++++
.../argument-incompatible-type-out.test | 9 +++++++++
.../argument-incompatible-type-ref.test | 9 +++++++++
tests/control-semantic/argument-missing.test | 8 ++++++++
tests/control-semantic/argument-named.test | 8 ++++++++
tests/control-semantic/argument-no-out.test | 9 +++++++++
tests/control-semantic/argument-no-ref.test | 9 +++++++++
tests/control-semantic/argument-null-ref.test | 8 ++++++++
tests/control-semantic/argument-owned-out.test | 9 +++++++++
tests/control-semantic/argument-owned-ref.test | 9 +++++++++
tests/control-semantic/argument-value-out.test | 8 ++++++++
tests/control-semantic/argument-value-ref.test | 8 ++++++++
.../control-semantic/member-incompatible-type.test | 11 +++++++++++
tests/control-semantic/member-invalid.test | 11 +++++++++++
tests/control-semantic/member-private.test | 11 +++++++++++
tests/control-semantic/member-readonly.test | 15 +++++++++++++++
tests/control-semantic/printf-too-few.test | 5 +++++
tests/control-semantic/printf-too-many.test | 5 +++++
.../variadic-argument-invalid.test | 13 +++++++++++++
20 files changed, 192 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7287130..8a1e859 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -137,6 +137,25 @@ TESTS = \
control-flow/bug736774-1.vala \
control-flow/bug736774-2.vala \
control-flow/bug790903.test \
+ control-semantic/argument-extra.test \
+ control-semantic/argument-incompatible-type-out.test \
+ control-semantic/argument-incompatible-type-ref.test \
+ control-semantic/argument-missing.test \
+ control-semantic/argument-named.test \
+ control-semantic/argument-no-out.test \
+ control-semantic/argument-no-ref.test \
+ control-semantic/argument-null-ref.test \
+ control-semantic/argument-owned-out.test \
+ control-semantic/argument-owned-ref.test \
+ control-semantic/argument-value-out.test \
+ control-semantic/argument-value-ref.test \
+ control-semantic/member-incompatible-type.test \
+ control-semantic/member-invalid.test \
+ control-semantic/member-private.test \
+ control-semantic/member-readonly.test \
+ control-semantic/printf-too-few.test \
+ control-semantic/printf-too-many.test \
+ control-semantic/variadic-argument-invalid.test \
enums/enum_only.vala \
enums/enums.vala \
enums/flags.vala \
diff --git a/tests/control-semantic/argument-extra.test b/tests/control-semantic/argument-extra.test
new file mode 100644
index 0000000..cb041d6
--- /dev/null
+++ b/tests/control-semantic/argument-extra.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (int arg) {
+}
+
+void main () {
+ foo (23, 42);
+}
diff --git a/tests/control-semantic/argument-incompatible-type-out.test
b/tests/control-semantic/argument-incompatible-type-out.test
new file mode 100644
index 0000000..6984764
--- /dev/null
+++ b/tests/control-semantic/argument-incompatible-type-out.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (out string arg) {
+}
+
+void main () {
+ int i;
+ foo (out i);
+}
diff --git a/tests/control-semantic/argument-incompatible-type-ref.test
b/tests/control-semantic/argument-incompatible-type-ref.test
new file mode 100644
index 0000000..a7ea6f2
--- /dev/null
+++ b/tests/control-semantic/argument-incompatible-type-ref.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (ref string arg) {
+}
+
+void main () {
+ int i = 42;
+ foo (ref i);
+}
diff --git a/tests/control-semantic/argument-missing.test b/tests/control-semantic/argument-missing.test
new file mode 100644
index 0000000..9298a50
--- /dev/null
+++ b/tests/control-semantic/argument-missing.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (int arg) {
+}
+
+void main () {
+ foo ();
+}
diff --git a/tests/control-semantic/argument-named.test b/tests/control-semantic/argument-named.test
new file mode 100644
index 0000000..5186a81
--- /dev/null
+++ b/tests/control-semantic/argument-named.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (int arg) {
+}
+
+void main () {
+ foo (arg: 23);
+}
diff --git a/tests/control-semantic/argument-no-out.test b/tests/control-semantic/argument-no-out.test
new file mode 100644
index 0000000..b4a53c6
--- /dev/null
+++ b/tests/control-semantic/argument-no-out.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (string arg) {
+}
+
+void main () {
+ string s;
+ foo (out s);
+}
diff --git a/tests/control-semantic/argument-no-ref.test b/tests/control-semantic/argument-no-ref.test
new file mode 100644
index 0000000..bad8816
--- /dev/null
+++ b/tests/control-semantic/argument-no-ref.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (string arg) {
+}
+
+void main () {
+ string s = "foo";
+ foo (ref s);
+}
diff --git a/tests/control-semantic/argument-null-ref.test b/tests/control-semantic/argument-null-ref.test
new file mode 100644
index 0000000..d54b3a6
--- /dev/null
+++ b/tests/control-semantic/argument-null-ref.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (ref string arg) {
+}
+
+void main () {
+ foo (null);
+}
diff --git a/tests/control-semantic/argument-owned-out.test b/tests/control-semantic/argument-owned-out.test
new file mode 100644
index 0000000..edcde78
--- /dev/null
+++ b/tests/control-semantic/argument-owned-out.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (out string arg) {
+}
+
+void main () {
+ unowned string s;
+ foo (out s);
+}
diff --git a/tests/control-semantic/argument-owned-ref.test b/tests/control-semantic/argument-owned-ref.test
new file mode 100644
index 0000000..2588e7d
--- /dev/null
+++ b/tests/control-semantic/argument-owned-ref.test
@@ -0,0 +1,9 @@
+Invalid Code
+
+void foo (ref owned string arg) {
+}
+
+void main () {
+ unowned string s = "foo";
+ foo (ref s);
+}
diff --git a/tests/control-semantic/argument-value-out.test b/tests/control-semantic/argument-value-out.test
new file mode 100644
index 0000000..128029a
--- /dev/null
+++ b/tests/control-semantic/argument-value-out.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (out string arg) {
+}
+
+void main () {
+ foo ("foo");
+}
diff --git a/tests/control-semantic/argument-value-ref.test b/tests/control-semantic/argument-value-ref.test
new file mode 100644
index 0000000..72dd67c
--- /dev/null
+++ b/tests/control-semantic/argument-value-ref.test
@@ -0,0 +1,8 @@
+Invalid Code
+
+void foo (ref string arg) {
+}
+
+void main () {
+ foo ("foo");
+}
diff --git a/tests/control-semantic/member-incompatible-type.test
b/tests/control-semantic/member-incompatible-type.test
new file mode 100644
index 0000000..5a03af5
--- /dev/null
+++ b/tests/control-semantic/member-incompatible-type.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+class Foo {
+ public string foo { get; set; }
+}
+
+void main () {
+ var foo = new Foo () {
+ foo = 42
+ };
+}
diff --git a/tests/control-semantic/member-invalid.test b/tests/control-semantic/member-invalid.test
new file mode 100644
index 0000000..0e67c9a
--- /dev/null
+++ b/tests/control-semantic/member-invalid.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+class Foo {
+ public string foo { get; set; }
+}
+
+void main () {
+ var foo = new Foo () {
+ bar = "foo"
+ };
+}
diff --git a/tests/control-semantic/member-private.test b/tests/control-semantic/member-private.test
new file mode 100644
index 0000000..afbaaaf
--- /dev/null
+++ b/tests/control-semantic/member-private.test
@@ -0,0 +1,11 @@
+Invalid Code
+
+class Foo {
+ string foo { get; set; }
+}
+
+void main () {
+ var foo = new Foo () {
+ foo = "foo"
+ };
+}
diff --git a/tests/control-semantic/member-readonly.test b/tests/control-semantic/member-readonly.test
new file mode 100644
index 0000000..13fbcab
--- /dev/null
+++ b/tests/control-semantic/member-readonly.test
@@ -0,0 +1,15 @@
+Invalid Code
+
+class Foo {
+ public string foo {
+ get {
+ return "bar";
+ }
+ }
+}
+
+void main () {
+ var foo = new Foo () {
+ foo = "foo"
+ };
+}
diff --git a/tests/control-semantic/printf-too-few.test b/tests/control-semantic/printf-too-few.test
new file mode 100644
index 0000000..dd56deb
--- /dev/null
+++ b/tests/control-semantic/printf-too-few.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+ print ("%d %d", 23);
+}
diff --git a/tests/control-semantic/printf-too-many.test b/tests/control-semantic/printf-too-many.test
new file mode 100644
index 0000000..f30e680
--- /dev/null
+++ b/tests/control-semantic/printf-too-many.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+ print ("%d", 23, 42);
+}
diff --git a/tests/control-semantic/variadic-argument-invalid.test
b/tests/control-semantic/variadic-argument-invalid.test
new file mode 100644
index 0000000..1299792
--- /dev/null
+++ b/tests/control-semantic/variadic-argument-invalid.test
@@ -0,0 +1,13 @@
+Invalid Code
+
+class Foo {
+ public signal void foo ();
+
+ public void bar (...) {
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+ foo.bar (foo.foo);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]