Commit a244dbaa authored by Christian Hergert's avatar Christian Hergert

testsuite: use g_assert_* macros instead of g_assert()

Fixes #43
parent 1de15cae
......@@ -63,7 +63,7 @@ test_consecutive_read (const gchar *inbuf,
g_assert_cmpstr (b, ==, outbuf);
close = g_input_stream_close (G_INPUT_STREAM (in), NULL, &err);
g_assert (close);
g_assert_true (close);
g_assert_no_error (err);
g_object_unref (buf);
......
......@@ -62,7 +62,7 @@ test_consecutive_write (const gchar *inbuf,
g_assert_no_error (err);
type = gtk_source_buffer_output_stream_detect_newline_type (out);
g_assert (type == newline_type);
g_assert_cmpint (type, ==, newline_type);
g_output_stream_close (G_OUTPUT_STREAM (out), NULL, &err);
g_assert_no_error (err);
......@@ -72,7 +72,7 @@ test_consecutive_write (const gchar *inbuf,
g_assert_cmpstr (outbuf, ==, b);
g_free (b);
g_assert (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (source_buffer)) == FALSE);
g_assert_false (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (source_buffer)));
g_object_unref (source_buffer);
g_object_unref (out);
......@@ -337,7 +337,7 @@ test_empty_conversion (void)
g_assert_cmpstr (out, ==, "");
g_free (out);
g_assert (guessed == gtk_source_encoding_get_utf8 ());
g_assert_true (guessed == gtk_source_encoding_get_utf8 ());
}
static void
......@@ -360,7 +360,7 @@ test_guessed (void)
&fail_len,
FALSE);
g_assert (fail == NULL);
g_assert_null (fail);
/* ISO-8859-15 should fail */
encs = g_slist_append (encs, (gpointer)gtk_source_encoding_get_from_charset ("ISO-8859-15"));
......@@ -370,7 +370,7 @@ test_guessed (void)
g_free (aux);
g_free (aux2);
g_assert (guessed == gtk_source_encoding_get_from_charset ("UTF-16"));
g_assert_true (guessed == gtk_source_encoding_get_from_charset ("UTF-16"));
}
static void
......
......@@ -71,8 +71,8 @@ test_get_buffer (void)
buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
g_assert (buffer != NULL);
g_assert (GTK_SOURCE_IS_BUFFER (buffer));
g_assert_nonnull (buffer);
g_assert_true (GTK_SOURCE_IS_BUFFER (buffer));
if (g_object_is_floating (view))
{
......@@ -111,7 +111,7 @@ test_get_context_classes (void)
/* test C */
lm = gtk_source_language_manager_get_default ();
lang = gtk_source_language_manager_get_language (lm, "c");
g_assert (GTK_SOURCE_IS_LANGUAGE (lang));
g_assert_true (GTK_SOURCE_IS_LANGUAGE (lang));
buffer = gtk_source_buffer_new_with_language (lang);
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer), c_snippet, -1);
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (buffer), &start, &end);
......@@ -347,7 +347,7 @@ test_bracket_matching (void)
language_manager = gtk_source_language_manager_get_default ();
c_language = gtk_source_language_manager_get_language (language_manager, "c");
g_assert (c_language != NULL);
g_assert_nonnull (c_language);
gtk_source_buffer_set_language (buffer, c_language);
/* Basics */
......
......@@ -189,16 +189,16 @@ check_provider (GtkSourceCompletionModel *model,
if (is_header_visible)
{
g_assert (gtk_source_completion_model_iter_is_header (model, iter));
g_assert_true (gtk_source_completion_model_iter_is_header (model, iter));
gtk_tree_model_get (GTK_TREE_MODEL (model), iter,
GTK_SOURCE_COMPLETION_MODEL_COLUMN_PROPOSAL, &proposal_get,
GTK_SOURCE_COMPLETION_MODEL_COLUMN_PROVIDER, &provider_get,
-1);
g_assert (proposal_get == NULL);
g_assert (provider_get == provider);
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), iter));
g_assert_null (proposal_get);
g_assert_true (provider_get == provider);
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), iter));
}
/* Check the proposals */
......@@ -211,8 +211,8 @@ check_provider (GtkSourceCompletionModel *model,
GTK_SOURCE_COMPLETION_MODEL_COLUMN_PROVIDER, &provider_get,
-1);
g_assert (proposal_get == cur_proposal->data);
g_assert (provider_get == provider);
g_assert_true (proposal_get == cur_proposal->data);
g_assert_true (provider_get == provider);
cur_proposal = g_list_next (cur_proposal);
......@@ -221,7 +221,7 @@ check_provider (GtkSourceCompletionModel *model,
break;
}
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), iter));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), iter));
}
}
......@@ -236,7 +236,7 @@ check_all_providers (GtkSourceCompletionModel *model,
GList *cur_provider = NULL;
GList *cur_list_proposals = NULL;
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter));
cur_provider = all_providers;
cur_list_proposals = all_list_proposals;
......@@ -253,14 +253,14 @@ check_all_providers (GtkSourceCompletionModel *model,
if (cur_provider == NULL)
{
g_assert (cur_list_proposals == NULL);
g_assert_null (cur_list_proposals);
break;
}
g_assert (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
g_assert_true (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
}
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
g_assert_true (!gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
}
static void
......@@ -314,8 +314,8 @@ test_is_empty (void)
/* Completely empty */
model = gtk_source_completion_model_new ();
g_assert (gtk_source_completion_model_is_empty (model, FALSE));
g_assert (gtk_source_completion_model_is_empty (model, TRUE));
g_assert_true (gtk_source_completion_model_is_empty (model, FALSE));
g_assert_true (gtk_source_completion_model_is_empty (model, TRUE));
/* One visible provider */
provider = test_provider_new ();
......@@ -326,15 +326,15 @@ test_is_empty (void)
GTK_SOURCE_COMPLETION_PROVIDER (provider),
list_proposals);
g_assert (!gtk_source_completion_model_is_empty (model, FALSE));
g_assert (!gtk_source_completion_model_is_empty (model, TRUE));
g_assert_false (gtk_source_completion_model_is_empty (model, FALSE));
g_assert_false (gtk_source_completion_model_is_empty (model, TRUE));
/* One invisible provider */
visible_providers = g_list_append (visible_providers, test_provider_new ());
gtk_source_completion_model_set_visible_providers (model, visible_providers);
g_assert (!gtk_source_completion_model_is_empty (model, FALSE));
g_assert (gtk_source_completion_model_is_empty (model, TRUE));
g_assert_false (gtk_source_completion_model_is_empty (model, FALSE));
g_assert_true (gtk_source_completion_model_is_empty (model, TRUE));
g_object_unref (model);
g_list_free_full (list_providers, g_object_unref);
......@@ -351,7 +351,7 @@ test_get_visible_providers (void)
GList *visible_providers = NULL;
model = gtk_source_completion_model_new ();
g_assert (gtk_source_completion_model_get_visible_providers (model) == NULL);
g_assert_null (gtk_source_completion_model_get_visible_providers (model));
provider = test_provider_new ();
list_providers = g_list_append (list_providers, provider);
......@@ -359,7 +359,7 @@ test_get_visible_providers (void)
gtk_source_completion_model_set_visible_providers (model, list_providers);
visible_providers = gtk_source_completion_model_get_visible_providers (model);
g_assert (visible_providers->data == provider);
g_assert_true (visible_providers->data == provider);
g_object_unref (model);
g_list_free_full (list_providers, g_object_unref);
......@@ -428,7 +428,7 @@ test_set_visible_providers (void)
other_provider = test_provider_new ();
subset_providers->data = other_provider;
gtk_source_completion_model_set_visible_providers (model, subset_providers);
g_assert (gtk_source_completion_model_is_empty (model, TRUE));
g_assert_true (gtk_source_completion_model_is_empty (model, TRUE));
/* The two providers are visible again */
gtk_source_completion_model_set_visible_providers (model, NULL);
......@@ -457,9 +457,9 @@ test_populate_several_batches (void)
/* First batch */
gtk_source_completion_model_add_proposals (model, provider, first_proposals);
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter));
check_provider (model, provider, first_proposals, TRUE, &iter);
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
/* Second batch */
gtk_source_completion_model_add_proposals (model, provider, second_proposals);
......@@ -467,9 +467,9 @@ test_populate_several_batches (void)
all_proposals = g_list_copy (first_proposals);
all_proposals = g_list_concat (all_proposals, g_list_copy (second_proposals));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter));
check_provider (model, provider, all_proposals, TRUE, &iter);
g_assert (!gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
g_assert_false (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
g_object_unref (model);
g_object_unref (provider);
......@@ -488,14 +488,14 @@ test_get_providers (void)
GList *providers_get = NULL;
/* Empty */
g_assert (gtk_source_completion_model_get_providers (model) == NULL);
g_assert_null (gtk_source_completion_model_get_providers (model));
/* Non-empty */
create_providers (&all_providers, &all_list_proposals);
populate_model (model, all_providers, all_list_proposals);
providers_get = gtk_source_completion_model_get_providers (model);
g_assert (same_list_contents (all_providers, providers_get));
g_assert_true (same_list_contents (all_providers, providers_get));
g_object_unref (model);
free_providers (all_providers, all_list_proposals);
......@@ -516,46 +516,46 @@ test_iters_impl (gboolean show_headers)
gint *indices;
/* Test last_proposal() */
g_assert (!gtk_source_completion_model_last_proposal (model, &last_iter));
g_assert_false (gtk_source_completion_model_last_proposal (model, &last_iter));
create_providers (&all_providers, &all_list_proposals);
populate_model (model, all_providers, all_list_proposals);
gtk_source_completion_model_set_show_headers (model, show_headers);
g_assert (gtk_source_completion_model_last_proposal (model, &last_iter));
g_assert_true (gtk_source_completion_model_last_proposal (model, &last_iter));
/* Get the last proposal by another means, and compare it */
nb_items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (model),
&other_iter,
NULL,
nb_items - 1));
g_assert_true (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (model),
&other_iter,
NULL,
nb_items - 1));
g_assert (gtk_source_completion_model_iter_equal (model, &last_iter, &other_iter));
g_assert_true (gtk_source_completion_model_iter_equal (model, &last_iter, &other_iter));
/* Test get_path() */
path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &last_iter);
indices = gtk_tree_path_get_indices (path);
g_assert (indices[0] == nb_items - 1);
g_assert_cmpint (indices[0], ==, nb_items - 1);
/* Test iter_previous() */
while (gtk_source_completion_model_iter_previous (model, &other_iter));
g_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &first_iter));
g_assert (gtk_source_completion_model_iter_equal (model, &first_iter, &other_iter));
g_assert_true (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &first_iter));
g_assert_true (gtk_source_completion_model_iter_equal (model, &first_iter, &other_iter));
/* Test iter_children() */
g_assert (gtk_tree_model_iter_children (GTK_TREE_MODEL (model), &other_iter, NULL));
g_assert (gtk_source_completion_model_iter_equal (model, &first_iter, &other_iter));
g_assert (!gtk_tree_model_iter_children (GTK_TREE_MODEL (model), &other_iter, &first_iter));
g_assert_true (gtk_tree_model_iter_children (GTK_TREE_MODEL (model), &other_iter, NULL));
g_assert_true (gtk_source_completion_model_iter_equal (model, &first_iter, &other_iter));
g_assert_false (gtk_tree_model_iter_children (GTK_TREE_MODEL (model), &other_iter, &first_iter));
/* Test iter_has_child() */
g_assert (!gtk_tree_model_iter_has_child (GTK_TREE_MODEL (model), &first_iter));
g_assert_false (gtk_tree_model_iter_has_child (GTK_TREE_MODEL (model), &first_iter));
/* Test iter_parent() */
g_assert (!gtk_tree_model_iter_parent (GTK_TREE_MODEL (model), &other_iter, &first_iter));
g_assert_false (gtk_tree_model_iter_parent (GTK_TREE_MODEL (model), &other_iter, &first_iter));
g_object_unref (model);
free_providers (all_providers, all_list_proposals);
......@@ -582,7 +582,7 @@ on_row_changed (GtkTreeModel *model,
-1);
/* Make sure that the signal was emitted for the good row. */
g_assert (proposal == row_proposal);
g_assert_true (proposal == row_proposal);
}
static void
......
......@@ -43,20 +43,20 @@ test_library_find (void)
library_add_words (library);
iter = gtk_source_completion_words_library_find_first (library, "a", -1);
g_assert (iter == NULL);
g_assert_null (iter);
iter = gtk_source_completion_words_library_find_first (library, "bba", -1);
g_assert (iter == NULL);
g_assert_null (iter);
iter = gtk_source_completion_words_library_find_first (library, "b", -1);
g_assert (iter != NULL);
g_assert_nonnull (iter);
proposal = gtk_source_completion_words_library_get_proposal (iter);
word = gtk_source_completion_words_proposal_get_word (proposal);
g_assert_cmpstr (word, ==, "bb");
iter = gtk_source_completion_words_library_find_first (library, "dd", -1);
g_assert (iter != NULL);
g_assert_nonnull (iter);
proposal = gtk_source_completion_words_library_get_proposal (iter);
word = gtk_source_completion_words_proposal_get_word (proposal);
......
......@@ -40,8 +40,8 @@ test_remove_duplicates (void)
list = _gtk_source_encoding_remove_duplicates (list, GTK_SOURCE_ENCODING_DUPLICATES_KEEP_FIRST);
g_assert_cmpint (2, ==, g_slist_length (list));
g_assert (list->data == utf8);
g_assert (list->next->data == iso);
g_assert_true (list->data == utf8);
g_assert_true (list->next->data == iso);
/* Before: [UTF-8, ISO-8859-15, UTF-8] */
list = g_slist_append (list, (gpointer) utf8);
......@@ -50,8 +50,8 @@ test_remove_duplicates (void)
list = _gtk_source_encoding_remove_duplicates (list, GTK_SOURCE_ENCODING_DUPLICATES_KEEP_LAST);
g_assert_cmpint (2, ==, g_slist_length (list));
g_assert (list->data == iso);
g_assert (list->next->data == utf8);
g_assert_true (list->data == iso);
g_assert_true (list->next->data == utf8);
g_slist_free (list);
}
......
......@@ -80,23 +80,23 @@ test_starts_full_word (void)
gtk_text_buffer_set_text (buffer, "foo--- ---bar", -1);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
g_assert (_gtk_source_iter_starts_full_word (&iter));
g_assert_true (_gtk_source_iter_starts_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 1);
g_assert (!_gtk_source_iter_starts_full_word (&iter));
g_assert_false (_gtk_source_iter_starts_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 7);
g_assert (_gtk_source_iter_starts_full_word (&iter));
g_assert_true (_gtk_source_iter_starts_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 10);
g_assert (!_gtk_source_iter_starts_full_word (&iter));
g_assert_false (_gtk_source_iter_starts_full_word (&iter));
gtk_text_buffer_set_text (buffer, " ab ", -1);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
g_assert (!_gtk_source_iter_starts_full_word (&iter));
g_assert_false (_gtk_source_iter_starts_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 4);
g_assert (!_gtk_source_iter_starts_full_word (&iter));
g_assert_false (_gtk_source_iter_starts_full_word (&iter));
g_object_unref (buffer);
}
......@@ -111,22 +111,22 @@ test_ends_full_word (void)
gtk_text_buffer_set_text (buffer, "foo--- ---bar ", -1);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 14);
g_assert (!_gtk_source_iter_ends_full_word (&iter));
g_assert_false (_gtk_source_iter_ends_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 13);
g_assert (_gtk_source_iter_ends_full_word (&iter));
g_assert_true (_gtk_source_iter_ends_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 12);
g_assert (!_gtk_source_iter_ends_full_word (&iter));
g_assert_false (_gtk_source_iter_ends_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 6);
g_assert (_gtk_source_iter_ends_full_word (&iter));
g_assert_true (_gtk_source_iter_ends_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 3);
g_assert (!_gtk_source_iter_ends_full_word (&iter));
g_assert_false (_gtk_source_iter_ends_full_word (&iter));
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
g_assert (!_gtk_source_iter_ends_full_word (&iter));
g_assert_false (_gtk_source_iter_ends_full_word (&iter));
g_object_unref (buffer);
}
......
......@@ -120,7 +120,7 @@ check_language (GtkSourceLanguage *language,
g_assert_cmpstr (gtk_source_language_get_id (language), ==, id);
g_assert_cmpstr (gtk_source_language_get_name (language), ==, expected_name);
g_assert_cmpstr (gtk_source_language_get_section (language), ==, expected_section);
g_assert (gtk_source_language_get_hidden (language) == expected_hidden);
g_assert_cmpint (gtk_source_language_get_hidden (language), ==, expected_hidden);
g_assert_cmpstr (gtk_source_language_get_metadata (language, "extra-meta"), ==, expected_extra_meta);
mime = gtk_source_language_get_mime_types (language);
......
......@@ -60,7 +60,7 @@ test_get_default (void)
lm1 = gtk_source_language_manager_get_default ();
lm2 = gtk_source_language_manager_get_default ();
g_assert (lm1 == lm2);
g_assert_true (lm1 == lm2);
}
static void
......@@ -71,20 +71,20 @@ test_get_language (void)
lm = gtk_source_language_manager_get_default ();
ids = gtk_source_language_manager_get_language_ids (lm);
g_assert (ids != NULL);
g_assert_nonnull (ids);
while (*ids != NULL)
{
GtkSourceLanguage *lang1, *lang2;
lang1 = gtk_source_language_manager_get_language (lm, *ids);
g_assert (lang1 != NULL);
g_assert (GTK_SOURCE_IS_LANGUAGE (lang1));
g_assert_nonnull (lang1);
g_assert_true (GTK_SOURCE_IS_LANGUAGE (lang1));
g_assert_cmpstr (*ids, == , gtk_source_language_get_id (lang1));
/* langs are owned by the manager */
lang2 = gtk_source_language_manager_get_language (lm, *ids);
g_assert (lang1 == lang2);
g_assert_true (lang1 == lang2);
++ids;
}
......@@ -143,16 +143,16 @@ test_guess_language (void)
g_test_trap_assert_failed ();
l = gtk_source_language_manager_guess_language (lm, "foo.abcdef", NULL);
g_assert (l == NULL);
g_assert_null (l);
l = gtk_source_language_manager_guess_language (lm, "foo.abcdef", "");
g_assert (l == NULL);
g_assert_null (l);
l = gtk_source_language_manager_guess_language (lm, NULL, "image/png");
g_assert (l == NULL);
g_assert_null (l);
l = gtk_source_language_manager_guess_language (lm, "", "image/png");
g_assert (l == NULL);
g_assert_null (l);
l = gtk_source_language_manager_guess_language (lm, "foo.c", NULL);
g_assert_cmpstr (gtk_source_language_get_id (l), ==, "c");
......
......@@ -30,9 +30,9 @@ test_create (void)
m = gtk_source_mark_new ("Mark 1", "test");
g_assert_cmpstr ("Mark 1", ==, gtk_text_mark_get_name (GTK_TEXT_MARK (m)));
g_assert_cmpstr ("test", ==, gtk_source_mark_get_category (m));
g_assert (NULL == gtk_text_mark_get_buffer (GTK_TEXT_MARK (m)));
g_assert (NULL == gtk_source_mark_next (m, NULL));
g_assert (NULL == gtk_source_mark_prev (m, NULL));
g_assert_null (gtk_text_mark_get_buffer (GTK_TEXT_MARK (m)));
g_assert_null (gtk_source_mark_next (m, NULL));
g_assert_null (gtk_source_mark_prev (m, NULL));
g_object_unref (m);
}
......@@ -55,15 +55,15 @@ test_prev_next (void)
gtk_text_iter_forward_char (&iter);
mark3 = gtk_source_buffer_create_source_mark (source_buffer, NULL, "cat1", &iter);
g_assert (mark2 == gtk_source_mark_next (mark1, NULL));
g_assert (mark3 == gtk_source_mark_next (mark1, "cat1"));
g_assert (NULL == gtk_source_mark_next (mark2, "cat2"));
g_assert (NULL == gtk_source_mark_next (mark3, NULL));
g_assert_true (mark2 == gtk_source_mark_next (mark1, NULL));
g_assert_true (mark3 == gtk_source_mark_next (mark1, "cat1"));
g_assert_null (gtk_source_mark_next (mark2, "cat2"));
g_assert_null (gtk_source_mark_next (mark3, NULL));
g_assert (mark1 == gtk_source_mark_prev (mark2, NULL));
g_assert (mark1 == gtk_source_mark_prev (mark3, "cat1"));
g_assert (NULL == gtk_source_mark_prev (mark2, "cat2"));
g_assert (NULL == gtk_source_mark_prev (mark1, NULL));
g_assert_true (mark1 == gtk_source_mark_prev (mark2, NULL));
g_assert_true (mark1 == gtk_source_mark_prev (mark3, "cat1"));
g_assert_null (gtk_source_mark_prev (mark2, "cat2"));
g_assert_null (gtk_source_mark_prev (mark1, NULL));
g_object_unref (source_buffer);
}
......@@ -123,15 +123,15 @@ test_get_source_marks_at_iter (void)
list = gtk_source_buffer_get_source_marks_at_iter (source_buffer, &iter, "cat1");
g_assert_cmpint (2, ==, g_slist_length (list));
g_assert (g_slist_find (list, mark1) != NULL);
g_assert (g_slist_find (list, mark3) != NULL);
g_assert_nonnull (g_slist_find (list, mark1));
g_assert_nonnull (g_slist_find (list, mark3));
g_slist_free (list);
list = gtk_source_buffer_get_source_marks_at_iter (source_buffer, &iter, NULL);
g_assert_cmpint (3, ==, g_slist_length (list));
g_assert (g_slist_find (list, mark1) != NULL);
g_assert (g_slist_find (list, mark2) != NULL);
g_assert (g_slist_find (list, mark3) != NULL);
g_assert_nonnull (g_slist_find (list, mark1));
g_assert_nonnull (g_slist_find (list, mark2));
g_assert_nonnull (g_slist_find (list, mark3));
g_object_unref (source_buffer);
}
......
......@@ -32,11 +32,11 @@ test_buffer_ref (void)
compositor = gtk_source_print_compositor_new (buffer_original);
buffer = gtk_source_print_compositor_get_buffer (compositor);
g_assert (GTK_SOURCE_IS_BUFFER (buffer));
g_assert_true (GTK_SOURCE_IS_BUFFER (buffer));
g_object_unref (G_OBJECT (buffer_original));
buffer = gtk_source_print_compositor_get_buffer (compositor);
g_assert (GTK_SOURCE_IS_BUFFER (buffer));
g_assert_true (GTK_SOURCE_IS_BUFFER (buffer));
}
static void
......@@ -49,11 +49,11 @@ test_buffer_view_ref (void)
view = gtk_source_view_new ();
compositor = gtk_source_print_compositor_new_from_view (GTK_SOURCE_VIEW (view));
buffer = gtk_source_print_compositor_get_buffer (compositor);
g_assert (GTK_SOURCE_IS_BUFFER (buffer));
g_assert_true (GTK_SOURCE_IS_BUFFER (buffer));
gtk_widget_destroy (view);
buffer = gtk_source_print_compositor_get_buffer (compositor);
g_assert (GTK_SOURCE_IS_BUFFER (buffer));
g_assert_true (GTK_SOURCE_IS_BUFFER (buffer));
g_object_unref (G_OBJECT (compositor));
}
......
......@@ -30,7 +30,7 @@ test_slash_c_pattern (void)
regex = _gtk_source_regex_new ("\\C", 0, &error);
g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_COMPILE);
g_assert (regex == NULL);
g_assert_null (regex);
}
int
......
......@@ -38,15 +38,15 @@ test_weak_ref (void)
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_source_region_add_subregion (region, &start, &end);
g_assert (!gtk_source_region_is_empty (region));
g_assert_false (gtk_source_region_is_empty (region));
g_object_unref (buffer);
g_assert (gtk_source_region_is_empty (region));
g_assert (!gtk_source_region_get_bounds (region, &start, &end));
g_assert_true (gtk_source_region_is_empty (region));
g_assert_false (gtk_source_region_get_bounds (region, &start, &end));
gtk_source_region_get_start_region_iter (region, &region_iter);
g_assert (!gtk_source_region_iter_get_subregion (&region_iter, &start, &end));
g_assert_false (gtk_source_region_iter_get_subregion (&region_iter, &start, &end));
g_object_unref (region);
}
......@@ -92,11 +92,11 @@ check_result (GtkSourceRegion *region,
if (expected_result == NULL)
{
g_assert (gtk_source_region_is_empty (region));
g_assert_true (gtk_source_region_is_empty (region));
return;
}
g_assert (!gtk_source_region_is_empty (region));
g_assert_false (gtk_source_region_is_empty (region));
expected_region_str = g_strconcat ("Subregions: ", expected_result, NULL);
region_str = gtk_source_region_to_string (region);
......@@ -117,13 +117,13 @@ test_add_subtract_subregion (void)
gtk_text_buffer_set_text (buffer, "This is a test of GtkSourceRegion", -1);
g_assert (gtk_source_region_is_empty (region));
g_assert_true (gtk_source_region_is_empty (region));
/* Add/remove 0-length subregions */
add_subregion (region, 5, 5);
g_assert (gtk_source_region_is_empty (region));
g_assert_true (gtk_source_region_is_empty (region));
subtract_subregion (region, 5, 5);
g_assert (gtk_source_region_is_empty (region));
g_assert_true (gtk_source_region_is_empty (region));
/* Add subregion */
add_subregion (region, 5, 10);
......@@ -138,7 +138,7 @@ test_add_subtract_subregion (void)
/* Remove all */
subtract_subregion (region, 1, 15);
g_assert (gtk_source_region_is_empty (region));
g_assert_true (gtk_source_region_is_empty (region));
/* Add two separate subregions */
add_subregion (region, 5, 10);
......@@ -238,7 +238,7 @@ test_intersect_subregion (void)
gtk_text_buffer_set_text (buffer, "This is a test of GtkSourceRegion", -1);
g_assert (gtk_source_region_is_empty (region));
g_assert_true (gtk_source_region_is_empty (region));
add_subregion (region, 0, 2);
add_subregion (region, 10, 15);
......@@ -269,7 +269,7 @@ test_add_subtract_intersect_region (void)
gtk_text_buffer_set_text (buffer, "This is a test of GtkSourceRegion", -1);
g_assert (gtk_source_region_is_empty (main_region));
g_assert_true (gtk_source_region_is_empty (main_region));
/* Basic tests */
......
......@@ -339,7 +339,7 @@ test_case_sensitivity (void)
gtk_source_search_settings_set_case_sensitive (settings, TRUE);
case_sensitive = gtk_source_search_settings_get_case_sensitive (settings);
g_assert (case_sensitive);
g_assert_true (case_sensitive);
flush_queue ();
occurrences_count = gtk_source_search_context_get_occurrences_count (context);
......@@ -347,7 +347,7 @@ test_case_sensitivity (void)
gtk_source_search_settings_set_case_sensitive (settings, FALSE);