[vala/staging] tests: Extend "direct access to error code" test to increase coverage



commit 7dbcea11562610bee7deb16bff750ae5d5fb10af
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Feb 22 13:10:20 2022 +0100

    tests: Extend "direct access to error code" test to increase coverage

 tests/errors/errorcode.c-expected | 10 ++++++++++
 tests/errors/errorcode.vala       |  7 +++++++
 2 files changed, 17 insertions(+)
---
diff --git a/tests/errors/errorcode.c-expected b/tests/errors/errorcode.c-expected
index fe2d65cd9..45c7db847 100644
--- a/tests/errors/errorcode.c-expected
+++ b/tests/errors/errorcode.c-expected
@@ -28,6 +28,7 @@ typedef enum  {
 #define FOO_ERROR foo_error_quark ()
 
 VALA_EXTERN GQuark foo_error_quark (void);
+VALA_EXTERN void bar (gint code);
 static void _vala_main (void);
 
 GQuark
@@ -36,6 +37,12 @@ foo_error_quark (void)
        return g_quark_from_static_string ("foo-error-quark");
 }
 
+void
+bar (gint code)
+{
+       _vala_assert (code == 23, "code == 23");
+}
+
 static void
 _vala_main (void)
 {
@@ -78,6 +85,9 @@ _vala_main (void)
                code = FOO_ERROR_EVEN_WORSE;
                _vala_assert (code == 23, "code == 23");
        }
+       {
+               bar (FOO_ERROR_EVEN_WORSE);
+       }
 }
 
 int
diff --git a/tests/errors/errorcode.vala b/tests/errors/errorcode.vala
index 2cb96ec67..b1e6d4ce9 100644
--- a/tests/errors/errorcode.vala
+++ b/tests/errors/errorcode.vala
@@ -4,6 +4,10 @@ errordomain FooError {
        EVEN_WORSE = 23
 }
 
+void bar (int code) {
+       assert (code == 23);
+}
+
 void main () {
        {
                var error = new IOError.NO_SPACE ("foo");
@@ -29,4 +33,7 @@ void main () {
                var code = FooError.EVEN_WORSE;
                assert (code == 23);
        }
+       {
+               bar (FooError.EVEN_WORSE);
+       }
 }


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