]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Extend "direct access to error code" test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 22 Feb 2022 12:10:20 +0000 (13:10 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 17 Mar 2022 10:52:20 +0000 (11:52 +0100)
tests/errors/errorcode.c-expected
tests/errors/errorcode.vala

index fe2d65cd99bb08545eb67150c543523d3d195e53..45c7db84749e5d7ace6656040fd457cfb6a48b51 100644 (file)
@@ -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
index 2cb96ec67962c580f83bd3fe488d917580b368bc..b1e6d4ce9b083db29f9a720dcae235d49edc9905 100644 (file)
@@ -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);
+       }
 }