[gobject-introspection] Add more coverage for recently added (skip) regress additions



commit 36d4260baa5e6b03c14b8abdcffedf9b940bedb3
Author: David Zeuthen <davidz redhat com>
Date:   Fri May 13 20:40:17 2011 -0400

    Add more coverage for recently added (skip) regress additions
    
    Whilst doing the gjs patch, it turned out this was needed in order to
    do a robust test suite - we really want to cover all bases here.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 tests/scanner/Regress-1.0-expected.gir |  144 +++++++++++++++++++++++++++++++-
 tests/scanner/regress.c                |  125 ++++++++++++++++++++++++----
 tests/scanner/regress.h                |   38 +++++++-
 3 files changed, 286 insertions(+), 21 deletions(-)
---
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 4d915b8..40bdf4e 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -534,10 +534,108 @@ case.</doc>
           </parameter>
         </parameters>
       </method>
+      <method name="skip_inout_param"
+              c:identifier="regress_test_obj_skip_inout_param"
+              throws="1">
+        <doc xml:whitespace="preserve">Check that the out value is skipped</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the call succeeds, %FALSE if @error is set.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="a" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Parameter.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="out_b"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="c" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Other parameter.</doc>
+            <type name="gdouble" c:type="gdouble"/>
+          </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full"
+                     skip="1">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
+      <method name="skip_out_param"
+              c:identifier="regress_test_obj_skip_out_param"
+              throws="1">
+        <doc xml:whitespace="preserve">Check that the out value is skipped</doc>
+        <return-value transfer-ownership="none">
+          <doc xml:whitespace="preserve">%TRUE if the call succeeds, %FALSE if @error is set.</doc>
+          <type name="gboolean" c:type="gboolean"/>
+        </return-value>
+        <parameters>
+          <parameter name="a" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Parameter.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="out_b"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full"
+                     skip="1">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="c" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Other parameter.</doc>
+            <type name="gdouble" c:type="gdouble"/>
+          </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+        </parameters>
+      </method>
       <method name="skip_param"
               c:identifier="regress_test_obj_skip_param"
               throws="1">
-        <doc xml:whitespace="preserve">Check that the return value is skipped</doc>
+        <doc xml:whitespace="preserve">Check that a parameter is skipped</doc>
         <return-value transfer-ownership="none">
           <doc xml:whitespace="preserve">%TRUE if the call succeeds, %FALSE if @error is set.</doc>
           <type name="gboolean" c:type="gboolean"/>
@@ -558,6 +656,28 @@ case.</doc>
             <doc xml:whitespace="preserve">Other parameter.</doc>
             <type name="gdouble" c:type="gdouble"/>
           </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
         </parameters>
       </method>
       <method name="skip_return_val"
@@ -584,6 +704,28 @@ case.</doc>
             <doc xml:whitespace="preserve">Other parameter.</doc>
             <type name="gdouble" c:type="gdouble"/>
           </parameter>
+          <parameter name="inout_d"
+                     direction="inout"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Will be incremented.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="out_sum"
+                     direction="out"
+                     caller-allocates="0"
+                     transfer-ownership="full">
+            <doc xml:whitespace="preserve">Return value.</doc>
+            <type name="gint" c:type="gint*"/>
+          </parameter>
+          <parameter name="num1" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
+          <parameter name="num2" transfer-ownership="none">
+            <doc xml:whitespace="preserve">Number.</doc>
+            <type name="gint" c:type="gint"/>
+          </parameter>
         </parameters>
       </method>
       <method name="torture_signature_0"
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index f8a552b..3d8690f 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -2038,6 +2038,10 @@ regress_test_obj_torture_signature_1 (RegressTestObj   *obj,
  * @a: Parameter.
  * @out_b: (out): A return value.
  * @c: Other parameter.
+ * @inout_d: (inout): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
  * @error: Return location for error.
  *
  * Check that the return value is skipped
@@ -2045,16 +2049,23 @@ regress_test_obj_torture_signature_1 (RegressTestObj   *obj,
  * Returns: (skip): %TRUE if the call succeeds, %FALSE if @error is set.
  */
 gboolean
-regress_test_obj_skip_return_val (RegressTestObj  *obj,
-                                  gint             a,
-                                  gint            *out_b,
-                                  gdouble          c,
-                                  GError         **error)
-{
-  if (a == 0)
-    return TRUE;
-  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "a is non-zero");
-  return FALSE;
+regress_test_obj_skip_return_val (RegressTestObj *obj,
+                                  gint            a,
+                                  gint           *out_b,
+                                  gdouble         c,
+                                  gint           *inout_d,
+                                  gint           *out_sum,
+                                  gint            num1,
+                                  gint            num2,
+                                  GError        **error)
+{
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
 }
 
 /**
@@ -2063,8 +2074,13 @@ regress_test_obj_skip_return_val (RegressTestObj  *obj,
  * @a: Parameter.
  * @out_b: (out): Return value.
  * @c: (skip): Other parameter.
+ * @inout_d: (inout): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
+ * @error: Return location for error.
  *
- * Check that the return value is skipped
+ * Check that a parameter is skipped
  *
  * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
  */
@@ -2073,12 +2089,91 @@ regress_test_obj_skip_param (RegressTestObj *obj,
                              gint            a,
                              gint           *out_b,
                              gdouble         c,
+                             gint           *inout_d,
+                             gint           *out_sum,
+                             gint            num1,
+                             gint            num2,
                              GError        **error)
 {
-  if (a == 0)
-    return TRUE;
-  g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "a is non-zero");
-  return FALSE;
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
+}
+
+/**
+ * regress_test_obj_skip_out_param:
+ * @obj: A #RegressTestObj.
+ * @a: Parameter.
+ * @out_b: (out) (skip): Return value.
+ * @c: Other parameter.
+ * @inout_d: (inout): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
+ * @error: Return location for error.
+ *
+ * Check that the out value is skipped
+ *
+ * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
+ */
+gboolean
+regress_test_obj_skip_out_param (RegressTestObj *obj,
+                                 gint            a,
+                                 gint           *out_b,
+                                 gdouble         c,
+                                 gint           *inout_d,
+                                 gint           *out_sum,
+                                 gint            num1,
+                                 gint            num2,
+                                 GError        **error)
+{
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
+}
+
+/**
+ * regress_test_obj_skip_inout_param:
+ * @obj: A #RegressTestObj.
+ * @a: Parameter.
+ * @out_b: (out): Return value.
+ * @c: Other parameter.
+ * @inout_d: (inout) (skip): Will be incremented.
+ * @out_sum: (out): Return value.
+ * @num1: Number.
+ * @num2: Number.
+ * @error: Return location for error.
+ *
+ * Check that the out value is skipped
+ *
+ * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
+ */
+gboolean
+regress_test_obj_skip_inout_param (RegressTestObj *obj,
+                                   gint            a,
+                                   gint           *out_b,
+                                   gdouble         c,
+                                   gint           *inout_d,
+                                   gint           *out_sum,
+                                   gint            num1,
+                                   gint            num2,
+                                   GError        **error)
+{
+  if (out_b != NULL)
+    *out_b = a + 1;
+  if (inout_d != NULL)
+    *inout_d = *inout_d + 1;
+  if (out_sum != NULL)
+    *out_sum = num1 + 10*num2;
+  return TRUE;
 }
 
 /**
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 562e8a4..ee535f6 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -352,18 +352,46 @@ gboolean regress_test_obj_torture_signature_1 (RegressTestObj    *obj,
                                        guint       m,
                                        GError    **error);
 
-gboolean regress_test_obj_skip_return_val (RegressTestObj  *obj,
-                                           gint             a,
-                                           gint            *out_b,
-                                           gdouble          c,
-                                           GError         **error);
+gboolean regress_test_obj_skip_return_val (RegressTestObj *obj,
+                                           gint            a,
+                                           gint           *out_b,
+                                           gdouble         c,
+                                           gint           *inout_d,
+                                           gint           *out_sum,
+                                           gint            num1,
+                                           gint            num2,
+                                           GError        **error);
 
 gboolean regress_test_obj_skip_param (RegressTestObj *obj,
                                       gint            a,
                                       gint           *out_b,
                                       gdouble         c,
+                                      gint           *inout_d,
+                                      gint           *out_sum,
+                                      gint            num1,
+                                      gint            num2,
                                       GError        **error);
 
+gboolean regress_test_obj_skip_out_param (RegressTestObj *obj,
+                                          gint            a,
+                                          gint           *out_b,
+                                          gdouble         c,
+                                          gint           *inout_d,
+                                          gint           *out_sum,
+                                          gint            num1,
+                                          gint            num2,
+                                          GError        **error);
+
+gboolean regress_test_obj_skip_inout_param (RegressTestObj *obj,
+                                            gint            a,
+                                            gint           *out_b,
+                                            gdouble         c,
+                                            gint           *inout_d,
+                                            gint           *out_sum,
+                                            gint            num1,
+                                            gint            num2,
+                                            GError        **error);
+
 /* virtual */
 int        regress_test_obj_do_matrix (RegressTestObj *obj, const char *somestr);
 



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