[vala/0.52] tests: Add more "declaration" tests for genie to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.52] tests: Add more "declaration" tests for genie to increase coverage
- Date: Sun, 14 Nov 2021 12:15:22 +0000 (UTC)
commit 1f27555d419e8e970c442689309840982b761f0e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Nov 5 11:08:23 2021 +0100
tests: Add more "declaration" tests for genie to increase coverage
tests/Makefile.am | 6 ++++++
tests/genie/class-field.gs | 10 ++++++++++
tests/genie/class-init.gs | 18 ++++++++++++++++++
tests/genie/class-signal.gs | 11 +++++++++++
tests/genie/constant.gs | 4 ++++
tests/genie/exception.gs | 7 +++++++
tests/genie/interface.gs | 10 ++++++++++
7 files changed, 66 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 34968c157..175e085ba 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1212,7 +1212,11 @@ TESTS = \
version/since-method.test \
version/since-parameter.test \
genie/class.gs \
+ genie/class-field.gs \
+ genie/class-init.gs \
genie/class-property.gs \
+ genie/class-signal.gs \
+ genie/constant.gs \
genie/control-flow-if-do.gs \
genie/control-flow-if-else.gs \
genie/control-flow-if-else-if.gs \
@@ -1222,6 +1226,7 @@ TESTS = \
genie/control-flow-if-less-than.gs \
genie/enum.gs \
genie/enum-with-keyword-values.gs \
+ genie/exception.gs \
genie/function.gs \
genie/function-returns-closure.gs \
genie/function-with-argument.gs \
@@ -1229,6 +1234,7 @@ TESTS = \
genie/indentation-with-spaces.gs \
genie/init.gs \
genie/init-int.gs \
+ genie/interface.gs \
genie/literal-boolean-assignment.gs \
genie/literal-boolean.gs \
genie/literal-character.gs \
diff --git a/tests/genie/class-field.gs b/tests/genie/class-field.gs
new file mode 100644
index 000000000..f6d93ac70
--- /dev/null
+++ b/tests/genie/class-field.gs
@@ -0,0 +1,10 @@
+init
+ var a = new Test()
+ assert( a.a == "a" )
+ assert( a.b == "b" )
+ assert( a.c == "c" )
+
+class Test
+ a:string = "a"
+ b:class string = "b"
+ c:static string = "c"
diff --git a/tests/genie/class-init.gs b/tests/genie/class-init.gs
new file mode 100644
index 000000000..edbe01b4d
--- /dev/null
+++ b/tests/genie/class-init.gs
@@ -0,0 +1,18 @@
+init
+ var a = new Test()
+
+def nothing()
+ pass
+
+class Test:Object
+ init
+ nothing()
+
+ init class
+ nothing()
+
+ init static
+ nothing()
+
+ final
+ nothing()
diff --git a/tests/genie/class-signal.gs b/tests/genie/class-signal.gs
new file mode 100644
index 000000000..718bbe164
--- /dev/null
+++ b/tests/genie/class-signal.gs
@@ -0,0 +1,11 @@
+init
+ var a = new Test()
+ a.foo.connect( test )
+ assert( a.foo(23) )
+ a.foo.disconnect( test )
+
+def test( a:int ):bool
+ return a == 23
+
+class Test
+ event foo( a:int ):bool
diff --git a/tests/genie/constant.gs b/tests/genie/constant.gs
new file mode 100644
index 000000000..9b4d445ab
--- /dev/null
+++ b/tests/genie/constant.gs
@@ -0,0 +1,4 @@
+init
+ assert( TEST == 23 )
+
+const TEST:int = 23
diff --git a/tests/genie/exception.gs b/tests/genie/exception.gs
new file mode 100644
index 000000000..eb52d229b
--- /dev/null
+++ b/tests/genie/exception.gs
@@ -0,0 +1,7 @@
+init
+ e:TestError = new TestError.BAD( "not so good" )
+
+exception TestError
+ FAIL
+ BAD
+ WORSE
diff --git a/tests/genie/interface.gs b/tests/genie/interface.gs
new file mode 100644
index 000000000..cb90d5cd7
--- /dev/null
+++ b/tests/genie/interface.gs
@@ -0,0 +1,10 @@
+init
+ var a = new Test()
+ assert( a.test(42) )
+
+interface ITest:Object
+ def abstract test( a:int ):bool
+
+class Test:Object implements ITest
+ def test( a:int ):bool
+ return a == 42
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]