[vala/0.40] tests: Add enum/errordomain tests for GIR parser to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] tests: Add enum/errordomain tests for GIR parser to increase coverage
- Date: Thu, 6 Dec 2018 13:11:14 +0000 (UTC)
commit 13a37c07f2d6a219aac67c0693320d8660958388
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Nov 15 10:23:55 2018 +0100
tests: Add enum/errordomain tests for GIR parser to increase coverage
tests/Makefile.am | 2 ++
tests/gir/enum.test | 81 ++++++++++++++++++++++++++++++++++++++++++++++
tests/gir/errordomain.test | 45 ++++++++++++++++++++++++++
3 files changed, 128 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 708683b95..0d07c1087 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -408,6 +408,8 @@ TESTS = \
gir/class.test \
gir/delegate-alias-without-target.test \
gir/delegate-closure-destroy-index-conflict.test \
+ gir/enum.test \
+ gir/errordomain.test \
gir/parameter-nullable-out-simple-type.test \
gir/property-non-readable.test \
annotations/deprecated.vala \
diff --git a/tests/gir/enum.test b/tests/gir/enum.test
new file mode 100644
index 000000000..251981a8b
--- /dev/null
+++ b/tests/gir/enum.test
@@ -0,0 +1,81 @@
+GIR
+
+Input:
+
+<enumeration name="Test"
+ c:type="Test">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_BAR">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_FOO">
+ </member>
+</enumeration>
+<enumeration name="TestWithType"
+ glib:type-name="TestWithType"
+ glib:get-type="test_with_type_get_type"
+ c:type="TestWithType">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_WITH_TYPE_BAR"
+ glib:nick="bar">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_WITH_TYPE_FOO"
+ glib:nick="foo">
+ </member>
+</enumeration>
+<bitfield name="TestFlag"
+ c:type="TestFlag">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_FLAG_BAR">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_FLAG_FOO">
+ </member>
+</bitfield>
+<bitfield name="TestFlagWithType"
+ glib:type-name="TestFlagWithType"
+ glib:get-type="test_flag_with_type_get_type"
+ c:type="TestFlagWithType">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_FLAG_WITH_TYPE_BAR"
+ glib:nick="bar">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_FLAG_WITH_TYPE_FOO"
+ glib:nick="foo">
+ </member>
+</bitfield>
+
+Output:
+
+[CCode (cheader_filename = "test.h", cname = "Test", cprefix = "TEST_", has_type_id = false)]
+public enum Test {
+ BAR,
+ FOO
+}
+[CCode (cheader_filename = "test.h", cname = "TestFlag", cprefix = "TEST_FLAG_", has_type_id = false)]
+[Flags]
+public enum TestFlag {
+ BAR,
+ FOO
+}
+[CCode (cheader_filename = "test.h", cname = "TestFlagWithType", cprefix = "TEST_FLAG_WITH_TYPE_", type_id =
"test_flag_with_type_get_type ()")]
+[Flags]
+public enum TestFlagWithType {
+ BAR,
+ FOO
+}
+[CCode (cheader_filename = "test.h", cname = "TestWithType", cprefix = "TEST_WITH_TYPE_", type_id =
"test_with_type_get_type ()")]
+public enum TestWithType {
+ BAR,
+ FOO
+}
diff --git a/tests/gir/errordomain.test b/tests/gir/errordomain.test
new file mode 100644
index 000000000..4ff318c79
--- /dev/null
+++ b/tests/gir/errordomain.test
@@ -0,0 +1,45 @@
+GIR
+
+Input:
+
+<enumeration name="TestError"
+ c:type="TestError"
+ glib:error-domain="test-error-quark">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_ERROR_BAR">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_ERROR_FOO">
+ </member>
+</enumeration>
+<enumeration name="TestErrorWithType"
+ glib:type-name="TestErrorWithType"
+ glib:get-type="test_error_with_type_get_type"
+ c:type="TestErrorWithType"
+ glib:error-domain="test-error-with-type-quark">
+ <member name="bar"
+ value="0"
+ c:identifier="TEST_ERROR_WITH_TYPE_BAR"
+ glib:nick="bar">
+ </member>
+ <member name="foo"
+ value="1"
+ c:identifier="TEST_ERROR_WITH_TYPE_FOO"
+ glib:nick="foo">
+ </member>
+</enumeration>
+
+Output:
+
+[CCode (cheader_filename = "test.h", cname = "TestError", cprefix = "TEST_ERROR_")]
+public errordomain TestError {
+ BAR,
+ FOO
+}
+[CCode (cheader_filename = "test.h", cname = "TestErrorWithType", cprefix = "TEST_ERROR_WITH_TYPE_")]
+public errordomain TestErrorWithType {
+ BAR,
+ FOO
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]