[glib] GConvert: improve test coverage
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GConvert: improve test coverage
- Date: Mon, 6 Jun 2011 05:15:04 +0000 (UTC)
commit 7cf16c3094d33c07960e2d563dd50ed56e525846
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 6 01:13:46 2011 -0400
GConvert: improve test coverage
glib/tests/convert.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/convert.c b/glib/tests/convert.c
index faa317e..680f707 100644
--- a/glib/tests/convert.c
+++ b/glib/tests/convert.c
@@ -650,6 +650,37 @@ test_unicode_conversions (void)
check_ucs4_to_utf16 (ucs4, 3, utf16, 0, 2);
}
+static void
+test_filename_utf8 (void)
+{
+ const gchar *filename = "/my/path/to/foo";
+ gchar *utf8;
+ gchar *back;
+ GError *error;
+
+ error = NULL;
+ utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, &error);
+ g_assert_no_error (error);
+ back = g_filename_from_utf8 (utf8, -1, NULL, NULL, &error);
+ g_assert_no_error (error);
+ g_assert_cmpstr (back, ==, filename);
+
+ g_free (utf8);
+ g_free (back);
+}
+
+static void
+test_filename_display (void)
+{
+ const gchar *filename = "/my/path/to/foo";
+ char *display;
+
+ display = g_filename_display_basename (filename);
+ g_assert_cmpstr (display, ==, "foo");
+
+ g_free (display);
+}
+
int
main (int argc, char *argv[])
{
@@ -659,6 +690,8 @@ main (int argc, char *argv[])
g_test_add_func ("/conversion/illegal-sequence", test_one_half);
g_test_add_func ("/conversion/byte-order", test_byte_order);
g_test_add_func ("/conversion/unicode", test_unicode_conversions);
+ g_test_add_func ("/conversion/filename-utf8", test_filename_utf8);
+ g_test_add_func ("/conversion/filename-display", test_filename_display);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]