[gspell] testsuite: replace g_assert() calls by g_assert_true()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell] testsuite: replace g_assert() calls by g_assert_true()
- Date: Sun, 3 Nov 2019 17:44:41 +0000 (UTC)
commit 5491acb3fa256cd5c11408e85920f462816138ca
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Nov 3 18:41:25 2019 +0100
testsuite: replace g_assert() calls by g_assert_true()
See the documentation of those functions.
Thanks to Tomasz Kłoczko for the bug report.
Fixes https://gitlab.gnome.org/GNOME/gspell/issues/7
testsuite/test-checker.c | 20 ++++++++++----------
testsuite/test-entry.c | 18 +++++++++---------
testsuite/test-inline-checker-text-buffer.c | 8 ++++----
testsuite/test-utils.c | 26 +++++++++++++-------------
4 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/testsuite/test-checker.c b/testsuite/test-checker.c
index a32e7dc..116d598 100644
--- a/testsuite/test-checker.c
+++ b/testsuite/test-checker.c
@@ -29,17 +29,17 @@ test_check_word (void)
GError *error = NULL;
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
correctly_spelled = gspell_checker_check_word (checker, "hello", -1, &error);
g_assert_no_error (error);
- g_assert (correctly_spelled);
+ g_assert_true (correctly_spelled);
correctly_spelled = gspell_checker_check_word (checker, "tkbqzat", -1, &error);
g_assert_no_error (error);
- g_assert (!correctly_spelled);
+ g_assert_true (!correctly_spelled);
g_object_unref (checker);
}
@@ -54,7 +54,7 @@ test_apostrophes (void)
GError *error = NULL;
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
@@ -65,7 +65,7 @@ test_apostrophes (void)
correctly_spelled = gspell_checker_check_word (checker, "doesn't", -1, &error);
g_assert_no_error (error);
- g_assert (correctly_spelled);
+ g_assert_true (correctly_spelled);
/* Modifier Letter Apostrophe U+02BC */
@@ -74,7 +74,7 @@ test_apostrophes (void)
correctly_spelled = gspell_checker_check_word (checker, "doesn\xCA\xBCt", -1, &error);
g_assert_no_error (error);
- g_assert (correctly_spelled);
+ g_assert_true (correctly_spelled);
/* Right Single Quotation Mark U+2019 */
@@ -83,7 +83,7 @@ test_apostrophes (void)
correctly_spelled = gspell_checker_check_word (checker, "doesn\xE2\x80\x99t", -1, &error);
g_assert_no_error (error);
- g_assert (correctly_spelled);
+ g_assert_true (correctly_spelled);
g_object_unref (checker);
}
@@ -97,7 +97,7 @@ test_dashes (void)
GError *error = NULL;
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
@@ -108,11 +108,11 @@ test_dashes (void)
*/
correctly_spelled = gspell_checker_check_word (checker, "spell-checking", -1, &error);
g_assert_no_error (error);
- g_assert (correctly_spelled);
+ g_assert_true (correctly_spelled);
correctly_spelled = gspell_checker_check_word (checker, "nrst-auie", -1, &error);
g_assert_no_error (error);
- g_assert (!correctly_spelled);
+ g_assert_true (!correctly_spelled);
g_object_unref (checker);
}
diff --git a/testsuite/test-entry.c b/testsuite/test-entry.c
index 866d556..4bef89a 100644
--- a/testsuite/test-entry.c
+++ b/testsuite/test-entry.c
@@ -37,7 +37,7 @@ create_entry (void)
g_object_ref_sink (gtk_entry);
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
gtk_buffer = gtk_entry_get_buffer (gtk_entry);
@@ -99,8 +99,8 @@ static void
check_entry_word_equal (GspellEntryWord *word1,
GspellEntryWord *word2)
{
- g_assert (word1 != NULL);
- g_assert (word2 != NULL);
+ g_assert_true (word1 != NULL);
+ g_assert_true (word2 != NULL);
g_assert_cmpstr (word1->word_str, ==, word2->word_str);
g_assert_cmpint (word1->byte_start, ==, word2->byte_start);
@@ -136,8 +136,8 @@ check_entry_word_list_equal (const GSList *list1,
check_entry_word_equal (word1, word2);
}
- g_assert (l1 == NULL);
- g_assert (l2 == NULL);
+ g_assert_true (l1 == NULL);
+ g_assert_true (l2 == NULL);
}
static void
@@ -253,7 +253,7 @@ test_init (void)
gtk_entry_set_text (gtk_entry, "auienrst");
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
gtk_buffer = gtk_entry_get_buffer (gtk_entry);
@@ -385,7 +385,7 @@ test_spell_checker_change (void)
/* Set a spell checker */
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
gspell_entry_buffer_set_spell_checker (gspell_buffer, checker);
@@ -439,7 +439,7 @@ test_language_change (void)
gspell_buffer = gspell_entry_buffer_get_from_gtk_entry_buffer (gtk_buffer);
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
gspell_entry_buffer_set_spell_checker (gspell_buffer, checker);
@@ -470,7 +470,7 @@ test_password_mode (void)
gtk_entry = create_entry ();
gspell_entry = gspell_entry_get_from_gtk_entry (gtk_entry);
- g_assert (gtk_entry_get_visibility (gtk_entry));
+ g_assert_true (gtk_entry_get_visibility (gtk_entry));
gtk_entry_set_text (gtk_entry, "auienrst");
expected_list = add_word (NULL, "auienrst", 0, 8);
diff --git a/testsuite/test-inline-checker-text-buffer.c b/testsuite/test-inline-checker-text-buffer.c
index 4ff7035..be42a86 100644
--- a/testsuite/test-inline-checker-text-buffer.c
+++ b/testsuite/test-inline-checker-text-buffer.c
@@ -32,7 +32,7 @@ create_buffer (void)
gspell_buffer = gspell_text_buffer_get_from_gtk_text_buffer (gtk_buffer);
lang = gspell_language_lookup ("en_US");
- g_assert (lang != NULL);
+ g_assert_true (lang != NULL);
checker = gspell_checker_new (lang);
gspell_text_buffer_set_spell_checker (gspell_buffer, checker);
@@ -75,7 +75,7 @@ check_highlighted_words (GtkTextBuffer *buffer,
gint remaining_list_element;
tag = _gspell_inline_checker_text_buffer_get_highlight_tag (inline_checker);
- g_assert (GTK_IS_TEXT_TAG (tag));
+ g_assert_true (GTK_IS_TEXT_TAG (tag));
gtk_text_buffer_get_start_iter (buffer, &iter);
va_start (list, inline_checker);
@@ -97,7 +97,7 @@ check_highlighted_words (GtkTextBuffer *buffer,
break;
}
- g_assert (gtk_text_iter_starts_tag (&start, tag));
+ g_assert_true (gtk_text_iter_starts_tag (&start, tag));
}
end = start;
@@ -105,7 +105,7 @@ check_highlighted_words (GtkTextBuffer *buffer,
{
g_assert_not_reached ();
}
- g_assert (gtk_text_iter_ends_tag (&end, tag));
+ g_assert_true (gtk_text_iter_ends_tag (&end, tag));
start_offset = gtk_text_iter_get_offset (&start);
expected_start_offset = va_arg (list, gint);
diff --git a/testsuite/test-utils.c b/testsuite/test-utils.c
index ed189bc..5072ce7 100644
--- a/testsuite/test-utils.c
+++ b/testsuite/test-utils.c
@@ -25,19 +25,19 @@ test_is_number (void)
gboolean is_number;
is_number = _gspell_utils_is_number ("123", -1);
- g_assert (is_number);
+ g_assert_true (is_number);
is_number = _gspell_utils_is_number ("123", 3);
- g_assert (is_number);
+ g_assert_true (is_number);
is_number = _gspell_utils_is_number ("123a4", 3);
- g_assert (is_number);
+ g_assert_true (is_number);
is_number = _gspell_utils_is_number ("123a4", -1);
- g_assert (!is_number);
+ g_assert_true (!is_number);
is_number = _gspell_utils_is_number ("h4ck1ng", -1);
- g_assert (!is_number);
+ g_assert_true (!is_number);
}
static void
@@ -69,36 +69,36 @@ test_str_to_ascii_apostrophe (void)
gboolean ret;
ret = _gspell_utils_str_to_ascii_apostrophe ("rock'n'roll", -1, &result);
- g_assert (!ret);
- g_assert (result == NULL);
+ g_assert_true (!ret);
+ g_assert_true (result == NULL);
ret = _gspell_utils_str_to_ascii_apostrophe ("rock\xCA\xBCn\xCA\xBCroll", -1, &result);
- g_assert (ret);
+ g_assert_true (ret);
g_assert_cmpstr (result, ==, "rock'n'roll");
g_free (result);
result = NULL;
ret = _gspell_utils_str_to_ascii_apostrophe ("rock\xE2\x80\x99n\xE2\x80\x99roll", -1, &result);
- g_assert (ret);
+ g_assert_true (ret);
g_assert_cmpstr (result, ==, "rock'n'roll");
g_free (result);
result = NULL;
ret = _gspell_utils_str_to_ascii_apostrophe ("rock\xCA\xBCn\xE2\x80\x99roll", -1, &result);
- g_assert (ret);
+ g_assert_true (ret);
g_assert_cmpstr (result, ==, "rock'n'roll");
g_free (result);
result = NULL;
ret = _gspell_utils_str_to_ascii_apostrophe ("rock\xCA\xBCn\xE2\x80\x99roll", 7, &result);
- g_assert (ret);
+ g_assert_true (ret);
g_assert_cmpstr (result, ==, "rock'n");
g_free (result);
result = NULL;
ret = _gspell_utils_str_to_ascii_apostrophe ("rock\xCA\xBCn\xE2\x80\x99roll", 4, &result);
- g_assert (!ret);
- g_assert (result == NULL);
+ g_assert_true (!ret);
+ g_assert_true (result == NULL);
}
gint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]