summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorentin Noël <corentin@elementary.io>2019-03-22 09:09:21 +0100
committerCorentin Noël <corentin@elementary.io>2019-03-22 09:46:07 +0100
commited4ed40f327f742d4b34342e5111f0fd14f0afa4 (patch)
tree93d12f981677f04f60334e95ebb6eea4e6d86acf
parent12957d17a7b1e2a0cd5ef5af54da0b9a49372131 (diff)
downloadvala-tintou/test-digit.tar.gz
tests: Add more invalid assignment teststintou/test-digit
-rw-r--r--tests/Makefile.am7
-rw-r--r--tests/arrays/expression-bracket.test13
-rw-r--r--tests/arrays/fixed-length-non-const.test6
-rw-r--r--tests/control-semantic/literal-immutable.test5
-rw-r--r--tests/control-semantic/this-assignment.test12
-rw-r--r--tests/objects/property-construct-only-write-foreign.test16
-rw-r--r--tests/objects/property-construct-only-write.test12
-rw-r--r--tests/objects/property-read-only.test12
8 files changed, 83 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a74461645..654cef008 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -68,7 +68,9 @@ TESTS = \
basic-types/bug787152.vala \
basic-types/bug788775.vala \
arrays/class-field-length-cname.vala \
+ arrays/expression-bracket.test \
arrays/field-global-length-cname.vala \
+ arrays/fixed-length-non-const.test \
arrays/struct-field-length-cname.vala \
arrays/incompatible-integer-elements.test \
arrays/slice-invalid-start.test \
@@ -184,12 +186,14 @@ TESTS = \
control-semantic/argument-owned-ref.test \
control-semantic/argument-value-out.test \
control-semantic/argument-value-ref.test \
+ control-semantic/literal-immutable.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/this-assignment.test \
control-semantic/variadic-argument-invalid.test \
enums/default-gtype.vala \
enums/enum_only.vala \
@@ -282,6 +286,7 @@ TESTS = \
objects/classes-implicit-implementation.vala \
objects/compact-class.vala \
objects/compact-class-destructor.vala \
+ objects/property-construct-only-write.test \
objects/constructor-abstract-public.test \
objects/constructor-variadic.test \
objects/constructors.vala \
@@ -301,7 +306,9 @@ TESTS = \
objects/plugin-module-init.vala \
objects/properties.vala \
objects/property-notify.vala \
+ objects/property-read-only.test \
objects/property-read-only-auto.vala \
+ objects/property-construct-only-write-foreign.test \
objects/property-static.vala \
objects/regex.vala \
objects/signals.vala \
diff --git a/tests/arrays/expression-bracket.test b/tests/arrays/expression-bracket.test
new file mode 100644
index 000000000..687e4b3a0
--- /dev/null
+++ b/tests/arrays/expression-bracket.test
@@ -0,0 +1,13 @@
+Invalid Code
+
+public int get_size () {
+ return 1;
+}
+
+public string[get_size ()] returns_array () {
+ return {"test"};
+}
+
+void main () {
+ returns_array ();
+}
diff --git a/tests/arrays/fixed-length-non-const.test b/tests/arrays/fixed-length-non-const.test
new file mode 100644
index 000000000..7ae22936f
--- /dev/null
+++ b/tests/arrays/fixed-length-non-const.test
@@ -0,0 +1,6 @@
+Invalid Code
+
+void main () {
+ int test_len = 60;
+ string test_array[test_len];
+}
diff --git a/tests/control-semantic/literal-immutable.test b/tests/control-semantic/literal-immutable.test
new file mode 100644
index 000000000..a335da9ee
--- /dev/null
+++ b/tests/control-semantic/literal-immutable.test
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+ true = false;
+}
diff --git a/tests/control-semantic/this-assignment.test b/tests/control-semantic/this-assignment.test
new file mode 100644
index 000000000..69dc5709a
--- /dev/null
+++ b/tests/control-semantic/this-assignment.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo {
+ public void do_bar () {
+ this = new Foo ();
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+ foo.do_bar ();
+}
diff --git a/tests/objects/property-construct-only-write-foreign.test b/tests/objects/property-construct-only-write-foreign.test
new file mode 100644
index 000000000..4ec5be7ff
--- /dev/null
+++ b/tests/objects/property-construct-only-write-foreign.test
@@ -0,0 +1,16 @@
+Invalid Code
+
+class Foo : GLib.Object {
+ public string test { construct; }
+ public Foo () {
+ var other = new Foo.ok ();
+ other.test = "";
+ }
+
+ public Foo.ok () {
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+}
diff --git a/tests/objects/property-construct-only-write.test b/tests/objects/property-construct-only-write.test
new file mode 100644
index 000000000..1b7636c77
--- /dev/null
+++ b/tests/objects/property-construct-only-write.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo : GLib.Object {
+ public string test { construct; }
+ public Foo () {
+ test = "";
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+}
diff --git a/tests/objects/property-read-only.test b/tests/objects/property-read-only.test
new file mode 100644
index 000000000..7e1e02de2
--- /dev/null
+++ b/tests/objects/property-read-only.test
@@ -0,0 +1,12 @@
+Invalid Code
+
+class Foo : GLib.Object {
+ public string test { get; }
+ public Foo () {
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+ foo.test= "";
+}