[vala/wip/issue/370: 20/20] tests: Add partial class test
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/370: 20/20] tests: Add partial class test
- Date: Sat, 2 Oct 2021 07:18:28 +0000 (UTC)
commit 9f1442189606e3a6abd7b468e6e67829d5eecb70
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Sep 21 14:31:22 2021 +0200
tests: Add partial class test
tests/Makefile.am | 5 ++
tests/objects/class-partial-conflict-abstract.test | 10 ++++
tests/objects/class-partial-conflict-access.test | 10 ++++
tests/objects/class-partial-conflict-partial.test | 10 ++++
tests/objects/class-partial-conflict-sealed.test | 10 ++++
tests/objects/class-partial.vala | 70 ++++++++++++++++++++++
6 files changed, 115 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d42298f6f..98f302d26 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -443,6 +443,11 @@ TESTS = \
objects/class-destroysinstance.vala \
objects/class-inner-types.vala \
objects/class-new-no-override.vala \
+ objects/class-partial.vala \
+ objects/class-partial-conflict-abstract.test \
+ objects/class-partial-conflict-access.test \
+ objects/class-partial-conflict-partial.test \
+ objects/class-partial-conflict-sealed.test \
objects/class-vfunc-base-access.vala \
objects/classes.vala \
objects/classes-interfaces.vala \
diff --git a/tests/objects/class-partial-conflict-abstract.test
b/tests/objects/class-partial-conflict-abstract.test
new file mode 100644
index 000000000..c34126d15
--- /dev/null
+++ b/tests/objects/class-partial-conflict-abstract.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+partial abstract class Foo {
+}
+
+partial class Foo {
+}
+
+void main () {
+}
diff --git a/tests/objects/class-partial-conflict-access.test
b/tests/objects/class-partial-conflict-access.test
new file mode 100644
index 000000000..d52e97532
--- /dev/null
+++ b/tests/objects/class-partial-conflict-access.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+public partial class Foo {
+}
+
+partial class Foo {
+}
+
+void main () {
+}
diff --git a/tests/objects/class-partial-conflict-partial.test
b/tests/objects/class-partial-conflict-partial.test
new file mode 100644
index 000000000..6ae9843c1
--- /dev/null
+++ b/tests/objects/class-partial-conflict-partial.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+class Foo {
+}
+
+partial class Foo {
+}
+
+void main () {
+}
diff --git a/tests/objects/class-partial-conflict-sealed.test
b/tests/objects/class-partial-conflict-sealed.test
new file mode 100644
index 000000000..16f7e8083
--- /dev/null
+++ b/tests/objects/class-partial-conflict-sealed.test
@@ -0,0 +1,10 @@
+Invalid Code
+
+partial sealed class Foo {
+}
+
+partial class Foo {
+}
+
+void main () {
+}
diff --git a/tests/objects/class-partial.vala b/tests/objects/class-partial.vala
new file mode 100644
index 000000000..15477f01c
--- /dev/null
+++ b/tests/objects/class-partial.vala
@@ -0,0 +1,70 @@
+public interface IFoo {
+ public abstract void i1 ();
+}
+
+public interface IBar {
+ public abstract void i2 ();
+}
+
+public partial class Foo : Object {
+ public string p0 { get; set; }
+ public string f0;
+ public void m0 () {
+ }
+ public virtual void v0 () {
+ }
+ public virtual signal void s0 () {
+ }
+}
+
+public partial class Foo : IFoo {
+ public string p1 { get; set; }
+ public string f1;
+ public void m1 () {
+ }
+ public virtual void v1 () {
+ }
+ public virtual signal void s1 () {
+ }
+ public void i1 () {
+ }
+}
+
+public partial class Foo : IBar {
+ public string p2 { get; set; }
+ public string f2;
+ public void m2 () {
+ }
+ public virtual void v2 () {
+ }
+ public virtual signal void s2 () {
+ }
+ public void i2 () {
+ }
+}
+
+void main () {
+ var foo = new Foo ();
+ foo.p0 = "p0";
+ foo.f0 = "f0";
+ foo.m0 ();
+ foo.v0 ();
+ foo.s0 ();
+
+ foo.p1 = "p1";
+ foo.f1 = "f1";
+ foo.m1 ();
+ foo.v1 ();
+ foo.s1 ();
+
+ foo.p2 = "p2";
+ foo.f2 = "f2";
+ foo.m2 ();
+ foo.v2 ();
+ foo.s2 ();
+
+ assert (foo is IFoo);
+ foo.i1 ();
+ assert (foo is IBar);
+ foo.i2 ();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]