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



commit af28b6a692c1e05757d026559e03a266cfc8df2f
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 764758955..5a9e9551d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -177,6 +177,7 @@ TESTS = \
        enums/enum_only.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]