[gspell/wip/apostrophe: 3/3] testsuite: add unit tests for the apostrophes
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell/wip/apostrophe: 3/3] testsuite: add unit tests for the apostrophes
- Date: Sat, 13 Feb 2016 17:00:44 +0000 (UTC)
commit 454d86b7a4ab335b93f6acdf331c49ff030dc93a
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Feb 13 17:21:06 2016 +0100
testsuite: add unit tests for the apostrophes
testsuite/test-checker.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/testsuite/test-checker.c b/testsuite/test-checker.c
index a7357d0..3a8b81a 100644
--- a/testsuite/test-checker.c
+++ b/testsuite/test-checker.c
@@ -34,11 +34,37 @@ test_check_word (void)
correctly_spelled = gspell_checker_check_word (checker, "hello", -1, &error);
g_assert_no_error (error);
- g_assert_true (correctly_spelled);
+ g_assert (correctly_spelled);
correctly_spelled = gspell_checker_check_word (checker, "tkbqzat", -1, &error);
g_assert_no_error (error);
- g_assert_false (correctly_spelled);
+ g_assert (!correctly_spelled);
+
+ g_object_unref (checker);
+}
+
+static void
+test_apostrophes (void)
+{
+ const GspellLanguage *lang;
+ GspellChecker *checker;
+ gboolean correctly_spelled;
+ gunichar apostrophe_char;
+ GError *error = NULL;
+
+ lang = gspell_language_lookup ("en_US");
+ g_assert (lang != NULL);
+
+ checker = gspell_checker_new (lang);
+
+ /* Apostrophe U+0027 */
+
+ apostrophe_char = g_utf8_get_char ("'");
+ g_assert_cmpint (apostrophe_char, ==, '\'');
+
+ correctly_spelled = gspell_checker_check_word (checker, "doesn't", -1, &error);
+ g_assert_no_error (error);
+ g_assert (correctly_spelled);
g_object_unref (checker);
}
@@ -50,6 +76,7 @@ main (gint argc,
gtk_test_init (&argc, &argv);
g_test_add_func ("/checker/check_word", test_check_word);
+ g_test_add_func ("/checker/apostrophes", test_apostrophes);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]