[gtksourceview/wip/fix-bug-search-context] SearchContext: fix bug regex replace with look-ahead
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/fix-bug-search-context] SearchContext: fix bug regex replace with look-ahead
- Date: Thu, 20 Aug 2015 17:16:09 +0000 (UTC)
commit 975217a5c5b0e416173c47116f0759470c0db3c1
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Aug 20 19:11:50 2015 +0200
SearchContext: fix bug regex replace with look-ahead
tests/test-search-context.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/tests/test-search-context.c b/tests/test-search-context.c
index f4c9d4d..09ae081 100644
--- a/tests/test-search-context.c
+++ b/tests/test-search-context.c
@@ -1065,6 +1065,8 @@ test_regex_look_behind (void)
gint pos;
gint offset;
gboolean found;
+ gchar *contents;
+ GError *error = NULL;
gtk_text_buffer_set_text (text_buffer, "12\n23\n123\n23\n12", -1);
@@ -1100,6 +1102,14 @@ test_regex_look_behind (void)
pos = gtk_source_search_context_get_occurrence_position (context, &match_start, &match_end);
g_assert_cmpint (pos, ==, 1);
+ /* Replace */
+ gtk_source_search_context_replace (context, &match_start, &match_end, "R", -1, &error);
+ g_assert_no_error (error);
+
+ contents = get_buffer_contents (text_buffer);
+ g_assert_cmpstr (contents, ==, "12\n23\n1R\n23\n12");
+ g_free (contents);
+
g_object_unref (source_buffer);
g_object_unref (settings);
g_object_unref (context);
@@ -1119,6 +1129,8 @@ test_regex_look_ahead (void)
gint pos;
gint offset;
gboolean found;
+ gchar *contents;
+ GError *error = NULL;
gtk_text_buffer_set_text (text_buffer, "12\n23\n123\n23\n12", -1);
@@ -1154,6 +1166,14 @@ test_regex_look_ahead (void)
pos = gtk_source_search_context_get_occurrence_position (context, &match_start, &match_end);
g_assert_cmpint (pos, ==, 1);
+ /* Replace */
+ gtk_source_search_context_replace (context, &match_start, &match_end, "R", -1, &error);
+ g_assert_no_error (error);
+
+ contents = get_buffer_contents (text_buffer);
+ g_assert_cmpstr (contents, ==, "12\n23\nR3\n23\n12");
+ g_free (contents);
+
g_object_unref (source_buffer);
g_object_unref (settings);
g_object_unref (context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]