[vala/tintou/test-digit] tests: Add more assignment tests
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/tintou/test-digit] tests: Add more assignment tests
- Date: Fri, 22 Mar 2019 08:21:12 +0000 (UTC)
commit 10a2720d884b60ce337e7af92ab84da6c9687d7e
Author: Corentin Noël <corentin elementary io>
Date: Fri Mar 22 09:09:21 2019 +0100
tests: Add more assignment tests
tests/Makefile.am | 7 +++++++
tests/arrays/expression-bracket.test | 13 +++++++++++++
tests/arrays/fixed-length.test | 6 ++++++
tests/control-semantic/literal-immutable.test | 5 +++++
tests/control-semantic/this-assignment.test | 12 ++++++++++++
tests/objects/property-construct-only-write.test | 12 ++++++++++++
tests/objects/property-read-only-construct.test | 16 ++++++++++++++++
tests/objects/property-read-only.test | 12 ++++++++++++
8 files changed, 83 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a74461645..8e91b0273 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.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-read-only-construct.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.test b/tests/arrays/fixed-length.test
new file mode 100644
index 000000000..7ae22936f
--- /dev/null
+++ b/tests/arrays/fixed-length.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.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-construct.test b/tests/objects/property-read-only-construct.test
new file mode 100644
index 000000000..4ec5be7ff
--- /dev/null
+++ b/tests/objects/property-read-only-construct.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-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= "";
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]