[vala/0.42] tests: Add "to_string" enum test to increase coverage



commit bd655b73882a36556401c4ca55b9b2a66bf49730
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Feb 23 20:19:31 2019 +0100

    tests: Add "to_string" enum test to increase coverage

 tests/Makefile.am                   |  1 +
 tests/enums/no_gtype_to_string.vala | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fd7e22297..51e71d2fd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -184,6 +184,7 @@ TESTS = \
        enums/enum-no-gtype.vala \
        enums/enums.vala \
        enums/flags.vala \
+       enums/no_gtype_to_string.vala \
        enums/bug666035.vala \
        enums/bug673879.vala \
        enums/bug763831.vala \
diff --git a/tests/enums/no_gtype_to_string.vala b/tests/enums/no_gtype_to_string.vala
new file mode 100644
index 000000000..a80d5eac9
--- /dev/null
+++ b/tests/enums/no_gtype_to_string.vala
@@ -0,0 +1,22 @@
+[CCode (has_type_id = false)]
+enum Foo {
+       BAR,
+       MANAM,
+       BAZ_FAZ
+}
+
+[CCode (has_type_id = false)]
+[Flags]
+enum Bar {
+       FOO,
+       MANAM,
+       FAZ_BAZ
+}
+
+void main () {
+       assert ("ENUMS_NO_GTYPE_TO_STRING_FOO_BAR" == Foo.BAR.to_string ());
+       assert ("ENUMS_NO_GTYPE_TO_STRING_FOO_BAZ_FAZ" == Foo.BAZ_FAZ.to_string ());
+
+       assert ("ENUMS_NO_GTYPE_TO_STRING_BAR_FOO" == Bar.FOO.to_string ());
+       assert ("ENUMS_NO_GTYPE_TO_STRING_BAR_FAZ_BAZ" == Bar.FAZ_BAZ.to_string ());
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]