[vala/staging: 6/10] tests: Add "to_string" enum test to increase coverage



commit 4e4ce22bdf93ec3ba3f12cc74b1fa2af66e32404
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 4b6bf8de8..38c13357d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -186,6 +186,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..1e8053dbc
--- /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 ("FOO_BAR" == Foo.BAR.to_string ());
+       assert ("FOO_BAZ_FAZ" == Foo.BAZ_FAZ.to_string ());
+
+       assert ("BAR_FOO" == Bar.FOO.to_string ());
+       assert ("BAR_FAZ_BAZ" == Bar.FAZ_BAZ.to_string ());
+}


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