[glib] Add a test for g_strip_prefix
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add a test for g_strip_prefix
- Date: Tue, 22 Jun 2010 03:09:45 +0000 (UTC)
commit 045c96b71a7755927e258c2b116c7c0ee8326bd1
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 21 23:07:46 2010 -0400
Add a test for g_strip_prefix
glib/tests/strfuncs.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c
index 8928ae6..2ddf926 100644
--- a/glib/tests/strfuncs.c
+++ b/glib/tests/strfuncs.c
@@ -1207,6 +1207,32 @@ test_bounds (void)
g_mapped_file_free (file);
}
+static void
+test_strip_context (void)
+{
+ const gchar *msgid;
+ const gchar *msgval;
+ const gchar *s;
+
+
+ msgid = "blabla";
+ msgval = "bla";
+ s = g_strip_context (msgid, msgval);
+ g_assert (s == msgval);
+
+ msgid = msgval = "blabla";
+ s = g_strip_context (msgid, msgval);
+ g_assert (s == msgval);
+
+ msgid = msgval = "blabla|foo";
+ s = g_strip_context (msgid, msgval);
+ g_assert (s == msgval + 7);
+
+ msgid = msgval = "blabla||bar";
+ s = g_strip_context (msgid, msgval);
+ g_assert (s == msgval + 7);
+}
+
int
main (int argc,
char *argv[])
@@ -1236,6 +1262,7 @@ main (int argc,
g_test_add_func ("/strfuncs/strtod", test_strtod);
g_test_add_func ("/strfuncs/strtoull-strtoll", test_strtoll);
g_test_add_func ("/strfuncs/bounds-check", test_bounds);
+ g_test_add_func ("/strfuncs/strip-context", test_strip_context);
return g_test_run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]