[vala/staging] tests: Extend "default gtype" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] tests: Extend "default gtype" tests to increase coverage
- Date: Mon, 6 Jul 2020 12:03:08 +0000 (UTC)
commit fe5a66a245811595c98061df14e605b9e793dd93
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Jul 5 21:40:22 2020 +0200
tests: Extend "default gtype" tests to increase coverage
tests/basic-types/default-gtype.vala | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
---
diff --git a/tests/basic-types/default-gtype.vala b/tests/basic-types/default-gtype.vala
index f987217ee..05f9dab1f 100644
--- a/tests/basic-types/default-gtype.vala
+++ b/tests/basic-types/default-gtype.vala
@@ -1,5 +1,7 @@
[CCode (cheader_filename = "glib-object.h", cname = "G_TYPE_STRV")]
extern GLib.Type G_TYPE_STRV;
+[CCode (cheader_filename = "glib-object.h", cname = "G_TYPE_ERROR")]
+extern GLib.Type G_TYPE_ERROR;
interface IFoo {
}
@@ -13,16 +15,43 @@ enum FooFlag {
FOO
}
+errordomain FooError {
+ FAIL
+}
+
struct FooStruct {
public int i;
}
+[CCode (has_type_id = false)]
+enum BarEnum {
+ BAR
+}
+
+[CCode (has_type_id = false)]
+[Flags]
+enum BarFlag {
+ BAR
+}
+
+[CCode (has_type_id = false)]
+struct BarStruct {
+ public int i;
+}
+
+[CCode (has_type_id = false)]
+[SimpleType]
+struct ManamStruct {
+ public int i;
+}
+
void main () {
assert (typeof (bool) == GLib.Type.BOOLEAN);
assert (typeof (FooStruct).is_a (GLib.Type.BOXED));
assert (typeof (char) == GLib.Type.CHAR);
assert (typeof (double) == GLib.Type.DOUBLE);
assert (typeof (FooEnum).is_a (GLib.Type.ENUM));
+ assert (typeof (FooError) == G_TYPE_ERROR);
assert (typeof (FooFlag).is_a (GLib.Type.FLAGS));
assert (typeof (float) == GLib.Type.FLOAT);
assert (typeof (int) == GLib.Type.INT);
@@ -41,4 +70,9 @@ void main () {
assert (typeof (uint64) == GLib.Type.UINT64);
assert (typeof (ulong) == GLib.Type.ULONG);
assert (typeof (Variant) == GLib.Type.VARIANT);
+
+ assert (typeof (BarEnum) == GLib.Type.INT);
+ assert (typeof (BarFlag) == GLib.Type.UINT);
+ assert (typeof (BarStruct) == GLib.Type.POINTER);
+ assert (typeof (ManamStruct) == GLib.Type.INVALID);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]