Fix lots of typos, document g_assert_error() and g_assert_no_error()
authorDan Winship <danw@src.gnome.org>
Sat, 27 Sep 2008 01:44:07 +0000 (01:44 +0000)
committerDan Winship <danw@src.gnome.org>
Sat, 27 Sep 2008 01:44:07 +0000 (01:44 +0000)
* glib/tmpl/testing.sgml: Fix lots of typos, document
g_assert_error() and g_assert_no_error()

svn path=/trunk/; revision=7557

docs/reference/ChangeLog
docs/reference/glib/glib-sections.txt
docs/reference/glib/tmpl/testing.sgml

index 662f3d942b99293fcf792c5f4fc852b6ba422f38..91ae6e432d6fd9c866c4f10c199a0cb2aaa59995 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-26  Dan Winship  <danw@gnome.org>
+
+       * glib/tmpl/testing.sgml: Fix lots of typos, document
+       g_assert_error() and g_assert_no_error()
+
 2008-09-26`  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/tmpl/iochannel.sgml: Move more docs inline
index 8b3415aae468e8ed7cc8b95fb4942ae468d4d2fb..fc3df78e952ae4687523feacda9e567c4356c1c5 100644 (file)
@@ -2611,6 +2611,8 @@ g_assert_cmpint
 g_assert_cmpuint
 g_assert_cmphex
 g_assert_cmpfloat
+g_assert_no_error
+g_assert_error
 
 GTestCase
 GTestSuite
@@ -2627,6 +2629,7 @@ g_assertion_message
 g_assertion_message_expr
 g_assertion_message_cmpstr
 g_assertion_message_cmpnum
+g_assertion_message_error
 
 g_test_add_vtable
 GTestConfig
index 5f2c4185269a32368ad9beed0dbff08ea0fc54c1..e5ec5abb06e6d7a02159d4f33406240a61e8ac00 100644 (file)
@@ -24,7 +24,7 @@ RUnit), which in turn is based on smalltalk unit testing concepts.
       A test fixture consists of fixture data and setup and teardown methods 
       to establish the environment for the test functions. We use fresh 
       fixtures, i.e. fixtures are newly set up and torn down around each test 
-      invokation to avoid dependencies between tests.
+      invocation to avoid dependencies between tests.
     </para></listitem>
   </varlistentry>
   <varlistentry>
@@ -53,7 +53,7 @@ is that the assertion messages can be more elaborate, and include the
 values of the compared entities.
 </para>
 <para>
-GLib ships with two utilites called gtester and gtester-report to 
+GLib ships with two utilities called gtester and gtester-report to 
 facilitate running tests and producing nicely formatted test reports. 
 </para>
 
@@ -433,7 +433,7 @@ The strings are compared using g_strcmp0().
 </para>
 <para>
 The effect of <literal>g_assert_cmpstr (s1, op, s2)</literal> is the same
-as <literal>g_assert (s1 op s2)</literal>. The advantage of this macro
+as <literal>g_assert (g_strcmp0 (s1, s2) op 0)</literal>. The advantage of this macro
 is that it can produce a message that includes the actual values of @s1
 and @s2.
 </para>
@@ -442,7 +442,7 @@ and @s2.
 </programlisting></informalexample>
 
 @s1: a string (may be %NULL)
-@cmp: The comparsion operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
+@cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
 @s2: another string (may be %NULL)
 @Since: 2.16
 
@@ -460,7 +460,7 @@ and @n2.
 </para>
 
 @n1: an integer
-@cmp: The comparsion operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
+@cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
 @n2: another integer
 @Since: 2.16
 
@@ -478,7 +478,7 @@ and @n2.
 </para>
 
 @n1: an unsigned integer
-@cmp: The comparsion operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
+@cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
 @n2: another unsigned integer
 @Since: 2.16
 
@@ -492,7 +492,7 @@ in the message.
 </para>
 
 @n1: an unsigned integer
-@cmp: The comparsion operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
+@cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
 @n2: another unsigned integer
 @Since: 2.16
 
@@ -503,18 +503,56 @@ Debugging macro to terminate the application with a warning message
 if a floating point number comparison fails.
 </para>
 <para>
-The effect of <literal>g_assert_cmpflott (n1, op, n2)</literal> is the same
+The effect of <literal>g_assert_cmpfloat (n1, op, n2)</literal> is the same
 as <literal>g_assert (n1 op n2)</literal>. The advantage of this function
 is that it can produce a message that includes the actual values of @n1
 and @n2.
 </para>
 
 @n1: an floating point number
-@cmp: The comparsion operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
+@cmp: The comparison operator to use. One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.
 @n2: another floating point number
 @Since: 2.16
 
 
+<!-- ##### MACRO g_assert_no_error ##### -->
+<para>
+Debugging macro to terminate the application with a warning message 
+if a method has returned a #GError.
+</para>
+<para>
+The effect of <literal>g_assert_no_error (err)</literal> is the same
+as <literal>g_assert (err == NULL)</literal>. The advantage of this macro
+is that it can produce a message that includes the error message and code.
+</para>
+
+@err: a #GError, possibly %NULL
+@Since: 2.20
+
+
+<!-- ##### MACRO g_assert_error ##### -->
+<para>
+Debugging macro to terminate the application with a warning message 
+if a method has not returned the correct #GError.
+</para>
+<para>
+The effect of <literal>g_assert_error (err, dom, c)</literal> is the same
+as <literal>g_assert (err != NULL &amp;&amp; err->domain == dom &amp;&amp; err->code == c)</literal>.
+The advantage of this macro is that it can produce a message that
+includes the incorrect error message and code.
+</para>
+<para>
+This can only be used to test for a specific error. If you want to
+test that @err is set, but don't care what it's set to, just use
+<literal>g_assert (err != NULL)</literal>
+</para>
+
+@err: a #GError, possibly %NULL
+@dom: the expected error domain (a #GQuark)
+@c: the expected error code
+@Since: 2.20
+
+
 <!-- ##### TYPEDEF GTestCase ##### -->
 <para>
 An opaque structure representing a test case.