[gnome-text-editor] spellcheck: add check for extra word chars
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] spellcheck: add check for extra word chars
- Date: Sun, 18 Jul 2021 16:09:12 +0000 (UTC)
commit 02f0281899fddc6a13210be59fa6619dc272c378
Author: Christian Hergert <chergert redhat com>
Date: Sun Jul 18 09:09:08 2021 -0700
spellcheck: add check for extra word chars
src/test-spell-cursor.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
---
diff --git a/src/test-spell-cursor.c b/src/test-spell-cursor.c
index 2062193..9edc860 100644
--- a/src/test-spell-cursor.c
+++ b/src/test-spell-cursor.c
@@ -2,6 +2,7 @@
#include "cjhtextregion.c"
static const char *test_text = "this is a series of words";
+static const char *test_text_2 = "it's possible we're going to have join-words.";
static char *
next_word (EditorSpellCursor *cursor)
@@ -78,6 +79,44 @@ test_cursor_in_word (void)
_cjh_text_region_free (region);
}
+static void
+test_cursor_join_words (void)
+{
+ g_autoptr(GtkTextBuffer) buffer = gtk_text_buffer_new (NULL);
+ CjhTextRegion *region = _cjh_text_region_new (NULL, NULL);
+ g_autoptr(EditorSpellCursor) cursor = editor_spell_cursor_new (buffer, region, NULL, "-'");
+ char *word;
+
+ gtk_text_buffer_set_text (buffer, test_text_2, -1);
+ _cjh_text_region_insert (region, 0, strlen (test_text_2), NULL);
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, "it's");
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, "possible");
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, "we're");
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, "going");
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, "to");
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, "have");
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, "join-words");
+
+ word = next_word (cursor);
+ g_assert_cmpstr (word, ==, NULL);
+
+ _cjh_text_region_free (region);
+}
+
int
main (int argc,
char *argv[])
@@ -85,5 +124,6 @@ main (int argc,
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Spelling/Cursor/basic", test_cursor);
g_test_add_func ("/Spelling/Cursor/in_word", test_cursor_in_word);
+ g_test_add_func ("/Spelling/Cursor/join_words", test_cursor_join_words);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]