From 1ae3a4aec122b9cfcc71b68185dc0a687cc63c62 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Sat, 27 Sep 2008 01:44:07 +0000 Subject: [PATCH] Fix lots of typos, document g_assert_error() and g_assert_no_error() * 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 | 5 +++ docs/reference/glib/glib-sections.txt | 3 ++ docs/reference/glib/tmpl/testing.sgml | 56 ++++++++++++++++++++++----- 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 662f3d942..91ae6e432 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2008-09-26 Dan Winship + + * glib/tmpl/testing.sgml: Fix lots of typos, document + g_assert_error() and g_assert_no_error() + 2008-09-26` Matthias Clasen * glib/tmpl/iochannel.sgml: Move more docs inline diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index 8b3415aae..fc3df78e9 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -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 diff --git a/docs/reference/glib/tmpl/testing.sgml b/docs/reference/glib/tmpl/testing.sgml index 5f2c41852..e5ec5abb0 100644 --- a/docs/reference/glib/tmpl/testing.sgml +++ b/docs/reference/glib/tmpl/testing.sgml @@ -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. @@ -53,7 +53,7 @@ is that the assertion messages can be more elaborate, and include the values of the compared entities. -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. @@ -433,7 +433,7 @@ The strings are compared using g_strcmp0(). The effect of g_assert_cmpstr (s1, op, s2) is the same -as g_assert (s1 op s2). The advantage of this macro +as g_assert (g_strcmp0 (s1, s2) op 0). The advantage of this macro is that it can produce a message that includes the actual values of @s1 and @s2. @@ -442,7 +442,7 @@ and @s2. @s1: a string (may be %NULL) -@cmp: The comparsion operator to use. One of ==, !=, <, >, <=, >=. +@cmp: The comparison operator to use. One of ==, !=, <, >, <=, >=. @s2: another string (may be %NULL) @Since: 2.16 @@ -460,7 +460,7 @@ and @n2. @n1: an integer -@cmp: The comparsion operator to use. One of ==, !=, <, >, <=, >=. +@cmp: The comparison operator to use. One of ==, !=, <, >, <=, >=. @n2: another integer @Since: 2.16 @@ -478,7 +478,7 @@ and @n2. @n1: an unsigned integer -@cmp: The comparsion operator to use. One of ==, !=, <, >, <=, >=. +@cmp: The comparison operator to use. One of ==, !=, <, >, <=, >=. @n2: another unsigned integer @Since: 2.16 @@ -492,7 +492,7 @@ in the message. @n1: an unsigned integer -@cmp: The comparsion operator to use. One of ==, !=, <, >, <=, >=. +@cmp: The comparison operator to use. One of ==, !=, <, >, <=, >=. @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. -The effect of g_assert_cmpflott (n1, op, n2) is the same +The effect of g_assert_cmpfloat (n1, op, n2) is the same as g_assert (n1 op n2). The advantage of this function is that it can produce a message that includes the actual values of @n1 and @n2. @n1: an floating point number -@cmp: The comparsion operator to use. One of ==, !=, <, >, <=, >=. +@cmp: The comparison operator to use. One of ==, !=, <, >, <=, >=. @n2: another floating point number @Since: 2.16 + + +Debugging macro to terminate the application with a warning message +if a method has returned a #GError. + + +The effect of g_assert_no_error (err) is the same +as g_assert (err == NULL). The advantage of this macro +is that it can produce a message that includes the error message and code. + + +@err: a #GError, possibly %NULL +@Since: 2.20 + + + + +Debugging macro to terminate the application with a warning message +if a method has not returned the correct #GError. + + +The effect of g_assert_error (err, dom, c) is the same +as g_assert (err != NULL && err->domain == dom && err->code == c). +The advantage of this macro is that it can produce a message that +includes the incorrect error message and code. + + +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 +g_assert (err != NULL) + + +@err: a #GError, possibly %NULL +@dom: the expected error domain (a #GQuark) +@c: the expected error code +@Since: 2.20 + + An opaque structure representing a test case.