1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
2 /*
3  * This file is part of GtkSourceView
4  *
5  * Copyright (C) 2014 - Sébastien Wilmet <swilmet@gnome.org>
6  *
7  * GtkSourceView is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * GtkSourceView is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "gtksourceview/gtksourceiter.h"
22 
23 static void
check_full_word_boundaries(gboolean forward,const gchar * buffer_text,gint initial_offset,gint result_offset)24 check_full_word_boundaries (gboolean     forward,
25 			    const gchar *buffer_text,
26 			    gint         initial_offset,
27 			    gint         result_offset)
28 {
29 	GtkTextBuffer *buffer;
30 	GtkTextIter iter;
31 
32 	buffer = gtk_text_buffer_new (NULL);
33 	gtk_text_buffer_set_text (buffer, buffer_text, -1);
34 
35 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, initial_offset);
36 
37 	if (forward)
38 	{
39 		_gtk_source_iter_forward_full_word_end (&iter);
40 	}
41 	else
42 	{
43 		_gtk_source_iter_backward_full_word_start (&iter);
44 	}
45 
46 	g_assert_cmpint (result_offset, ==, gtk_text_iter_get_offset (&iter));
47 
48 	g_object_unref (buffer);
49 }
50 
51 static void
test_forward_full_word_end(void)52 test_forward_full_word_end (void)
53 {
54 	check_full_word_boundaries (TRUE, "  ---- abcd ", 2, 6);
55 	check_full_word_boundaries (TRUE, "  ---- abcd ", 0, 6);
56 	check_full_word_boundaries (TRUE, "  ---- abcd ", 4, 6);
57 	check_full_word_boundaries (TRUE, "  ---- abcd ", 8, 11);
58 	check_full_word_boundaries (TRUE, "  ---- abcd ", 11, 11);
59 	check_full_word_boundaries (TRUE, "  ---- abcd \n  ----", 11, 19);
60 }
61 
62 static void
test_backward_full_word_start(void)63 test_backward_full_word_start (void)
64 {
65 	check_full_word_boundaries (FALSE, "---- abcd  ", 9, 5);
66 	check_full_word_boundaries (FALSE, "---- abcd  ", 11, 5);
67 	check_full_word_boundaries (FALSE, "---- abcd  ", 7, 5);
68 	check_full_word_boundaries (FALSE, "---- abcd  ", 3, 0);
69 	check_full_word_boundaries (FALSE, " ---- abcd  ", 1, 1);
70 	check_full_word_boundaries (FALSE, "abcd \n ---- abcd  ", 7, 0);
71 }
72 
73 static void
test_starts_full_word(void)74 test_starts_full_word (void)
75 {
76 	GtkTextBuffer *buffer;
77 	GtkTextIter iter;
78 
79 	buffer = gtk_text_buffer_new (NULL);
80 	gtk_text_buffer_set_text (buffer, "foo--- ---bar", -1);
81 
82 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
83 	g_assert_true (_gtk_source_iter_starts_full_word (&iter));
84 
85 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 1);
86 	g_assert_false (_gtk_source_iter_starts_full_word (&iter));
87 
88 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 7);
89 	g_assert_true (_gtk_source_iter_starts_full_word (&iter));
90 
91 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 10);
92 	g_assert_false (_gtk_source_iter_starts_full_word (&iter));
93 
94 	gtk_text_buffer_set_text (buffer, " ab ", -1);
95 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
96 	g_assert_false (_gtk_source_iter_starts_full_word (&iter));
97 
98 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 4);
99 	g_assert_false (_gtk_source_iter_starts_full_word (&iter));
100 
101 	g_object_unref (buffer);
102 }
103 
104 static void
test_ends_full_word(void)105 test_ends_full_word (void)
106 {
107 	GtkTextBuffer *buffer;
108 	GtkTextIter iter;
109 
110 	buffer = gtk_text_buffer_new (NULL);
111 	gtk_text_buffer_set_text (buffer, "foo--- ---bar ", -1);
112 
113 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 14);
114 	g_assert_false (_gtk_source_iter_ends_full_word (&iter));
115 
116 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 13);
117 	g_assert_true (_gtk_source_iter_ends_full_word (&iter));
118 
119 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 12);
120 	g_assert_false (_gtk_source_iter_ends_full_word (&iter));
121 
122 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 6);
123 	g_assert_true (_gtk_source_iter_ends_full_word (&iter));
124 
125 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 3);
126 	g_assert_false (_gtk_source_iter_ends_full_word (&iter));
127 
128 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
129 	g_assert_false (_gtk_source_iter_ends_full_word (&iter));
130 
131 	g_object_unref (buffer);
132 }
133 
134 static void
check_extra_natural_word_boundaries(gboolean forward,const gchar * buffer_text,gint initial_offset,gint result_offset)135 check_extra_natural_word_boundaries (gboolean     forward,
136 				     const gchar *buffer_text,
137 				     gint         initial_offset,
138 				     gint         result_offset)
139 {
140 	GtkTextBuffer *buffer;
141 	GtkTextIter iter;
142 
143 	buffer = gtk_text_buffer_new (NULL);
144 	gtk_text_buffer_set_text (buffer, buffer_text, -1);
145 
146 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, initial_offset);
147 
148 	if (forward)
149 	{
150 		_gtk_source_iter_forward_extra_natural_word_end (&iter);
151 	}
152 	else
153 	{
154 		_gtk_source_iter_backward_extra_natural_word_start (&iter);
155 	}
156 
157 	g_assert_cmpint (result_offset, ==, gtk_text_iter_get_offset (&iter));
158 
159 	g_object_unref (buffer);
160 }
161 
162 static void
test_forward_extra_natural_word_end(void)163 test_forward_extra_natural_word_end (void)
164 {
165 	const gchar *str = "hello_world ---- blah";
166 
167 	check_extra_natural_word_boundaries (TRUE, str, 0, 11);
168 	check_extra_natural_word_boundaries (TRUE, str, 1, 11);
169 	check_extra_natural_word_boundaries (TRUE, str, 5, 11);
170 	check_extra_natural_word_boundaries (TRUE, str, 6, 11);
171 	check_extra_natural_word_boundaries (TRUE, str, 11, 21);
172 	check_extra_natural_word_boundaries (TRUE, str, 21, 21);
173 
174 	check_extra_natural_word_boundaries (TRUE, "ab ", 2, 2);
175 	check_extra_natural_word_boundaries (TRUE, "a_ ", 2, 2);
176 	check_extra_natural_word_boundaries (TRUE, "ab \ncd", 2, 6);
177 	check_extra_natural_word_boundaries (TRUE, "a_ \n_d", 2, 6);
178 
179 	check_extra_natural_word_boundaries (TRUE, "__ ab", 0, 2);
180 	check_extra_natural_word_boundaries (TRUE, "--__--", 0, 4);
181 	check_extra_natural_word_boundaries (TRUE, "--__-- ab", 0, 4);
182 }
183 
184 static void
test_backward_extra_natural_word_start(void)185 test_backward_extra_natural_word_start (void)
186 {
187 	const gchar *str = "hello_world ---- blah";
188 
189 	check_extra_natural_word_boundaries (FALSE, str, 21, 17);
190 	check_extra_natural_word_boundaries (FALSE, str, 20, 17);
191 	check_extra_natural_word_boundaries (FALSE, str, 17, 0);
192 	check_extra_natural_word_boundaries (FALSE, str, 11, 0);
193 	check_extra_natural_word_boundaries (FALSE, str, 6, 0);
194 	check_extra_natural_word_boundaries (FALSE, str, 5, 0);
195 	check_extra_natural_word_boundaries (FALSE, str, 0, 0);
196 
197 	check_extra_natural_word_boundaries (FALSE, " cd", 1, 1);
198 	check_extra_natural_word_boundaries (FALSE, " _d", 1, 1);
199 	check_extra_natural_word_boundaries (FALSE, "ab\n cd", 4, 0);
200 	check_extra_natural_word_boundaries (FALSE, "_b\n c_", 4, 0);
201 
202 	check_extra_natural_word_boundaries (FALSE, "ab __", 5, 3);
203 	check_extra_natural_word_boundaries (FALSE, "--__--", 6, 2);
204 	check_extra_natural_word_boundaries (FALSE, "ab --__--", 9, 5);
205 }
206 
207 static void
check_starts_extra_natural_word(const gchar * buffer_text,gint offset,gboolean starts)208 check_starts_extra_natural_word (const gchar *buffer_text,
209 				 gint         offset,
210 				 gboolean     starts)
211 {
212 	GtkTextBuffer *buffer;
213 	GtkTextIter iter;
214 
215 	buffer = gtk_text_buffer_new (NULL);
216 	gtk_text_buffer_set_text (buffer, buffer_text, -1);
217 
218 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
219 	g_assert_cmpint (starts, ==, _gtk_source_iter_starts_extra_natural_word (&iter, TRUE));
220 
221 	g_object_unref (buffer);
222 }
223 
224 static void
test_starts_extra_natural_word(void)225 test_starts_extra_natural_word (void)
226 {
227 	check_starts_extra_natural_word ("ab", 2, FALSE);
228 	check_starts_extra_natural_word ("hello", 0, TRUE);
229 	check_starts_extra_natural_word ("__", 0, TRUE);
230 	check_starts_extra_natural_word (" hello", 0, FALSE);
231 	check_starts_extra_natural_word (" hello", 1, TRUE);
232 	check_starts_extra_natural_word ("_hello", 1, FALSE);
233 	check_starts_extra_natural_word ("()", 1, FALSE);
234 	check_starts_extra_natural_word ("__", 1, FALSE);
235 	check_starts_extra_natural_word (" __", 1, TRUE);
236 	check_starts_extra_natural_word (" __hello", 1, TRUE);
237 	check_starts_extra_natural_word ("hello_", 5, FALSE);
238 }
239 
240 static void
check_ends_extra_natural_word(const gchar * buffer_text,gint offset,gboolean ends)241 check_ends_extra_natural_word (const gchar *buffer_text,
242 			       gint         offset,
243 			       gboolean     ends)
244 {
245 	GtkTextBuffer *buffer;
246 	GtkTextIter iter;
247 
248 	buffer = gtk_text_buffer_new (NULL);
249 	gtk_text_buffer_set_text (buffer, buffer_text, -1);
250 
251 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
252 	g_assert_cmpint (ends, ==, _gtk_source_iter_ends_extra_natural_word (&iter, TRUE));
253 
254 	g_object_unref (buffer);
255 }
256 
257 static void
test_ends_extra_natural_word(void)258 test_ends_extra_natural_word (void)
259 {
260 	check_ends_extra_natural_word ("ab", 0, FALSE);
261 	check_ends_extra_natural_word ("ab", 2, TRUE);
262 	check_ends_extra_natural_word ("__", 2, TRUE);
263 	check_ends_extra_natural_word ("ab ", 3, FALSE);
264 	check_ends_extra_natural_word ("ab ", 2, TRUE);
265 	check_ends_extra_natural_word ("ab_", 2, FALSE);
266 	check_ends_extra_natural_word ("()", 1, FALSE);
267 	check_ends_extra_natural_word ("__ ", 1, FALSE);
268 	check_ends_extra_natural_word ("__ab ", 2, FALSE);
269 	check_ends_extra_natural_word ("__ ", 2, TRUE);
270 }
271 
272 static void
check_word_boundaries(const gchar * buffer_text,gint offset,gboolean starts_word_result,gboolean ends_word_result,gboolean inside_word_result)273 check_word_boundaries (const gchar *buffer_text,
274 		       gint         offset,
275 		       gboolean     starts_word_result,
276 		       gboolean     ends_word_result,
277 		       gboolean     inside_word_result)
278 {
279 	GtkTextBuffer *buffer;
280 	GtkTextIter iter;
281 
282 	buffer = gtk_text_buffer_new (NULL);
283 	gtk_text_buffer_set_text (buffer, buffer_text, -1);
284 
285 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
286 
287 	g_assert_cmpint (starts_word_result, ==, _gtk_source_iter_starts_word (&iter));
288 	g_assert_cmpint (ends_word_result, ==, _gtk_source_iter_ends_word (&iter));
289 	g_assert_cmpint (inside_word_result, ==, _gtk_source_iter_inside_word (&iter));
290 
291 	g_object_unref (buffer);
292 }
293 
294 static void
test_word_boundaries(void)295 test_word_boundaries (void)
296 {
297 	check_word_boundaries ("ab()cd", 0, TRUE, FALSE, TRUE);
298 	check_word_boundaries ("ab()cd", 1, FALSE, FALSE, TRUE);
299 	check_word_boundaries ("ab()cd", 2, TRUE, TRUE, TRUE);
300 	check_word_boundaries ("ab()cd", 3, FALSE, FALSE, TRUE);
301 	check_word_boundaries ("ab()cd", 4, TRUE, TRUE, TRUE);
302 	check_word_boundaries ("ab()cd", 5, FALSE, FALSE, TRUE);
303 	check_word_boundaries ("ab()cd", 6, FALSE, TRUE, FALSE);
304 
305 	check_word_boundaries (" ab", 0, FALSE, FALSE, FALSE);
306 	check_word_boundaries ("ab ", 3, FALSE, FALSE, FALSE);
307 
308 	check_word_boundaries (" () ", 1, TRUE, FALSE, TRUE);
309 	check_word_boundaries (" () ", 3, FALSE, TRUE, FALSE);
310 }
311 
312 static void
check_word_boundaries_movement(gboolean forward,const gchar * buffer_text,gint initial_offset,gint result_offset,gboolean ret)313 check_word_boundaries_movement (gboolean     forward,
314 				const gchar *buffer_text,
315 				gint         initial_offset,
316 				gint         result_offset,
317 				gboolean     ret)
318 {
319 	GtkTextBuffer *buffer;
320 	GtkTextIter iter;
321 
322 	buffer = gtk_text_buffer_new (NULL);
323 	gtk_text_buffer_set_text (buffer, buffer_text, -1);
324 
325 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, initial_offset);
326 
327 	if (forward)
328 	{
329 		g_assert_cmpint (ret, ==, _gtk_source_iter_forward_visible_word_end (&iter));
330 	}
331 	else
332 	{
333 		g_assert_cmpint (ret, ==, _gtk_source_iter_backward_visible_word_start (&iter));
334 	}
335 
336 	g_assert_cmpint (result_offset, ==, gtk_text_iter_get_offset (&iter));
337 
338 	g_object_unref (buffer);
339 }
340 
341 static void
test_forward_word_end(void)342 test_forward_word_end (void)
343 {
344 	check_word_boundaries_movement (TRUE, "---- aaaa", 0, 4, TRUE);
345 	check_word_boundaries_movement (TRUE, "---- aaaa", 1, 4, TRUE);
346 	check_word_boundaries_movement (TRUE, "---- aaaa", 4, 9, FALSE);
347 	check_word_boundaries_movement (TRUE, "---- aaaa", 5, 9, FALSE);
348 	check_word_boundaries_movement (TRUE, "---- aaaa", 6, 9, FALSE);
349 	check_word_boundaries_movement (TRUE, "aaaa ----", 0, 4, TRUE);
350 	check_word_boundaries_movement (TRUE, "aaaa ----", 1, 4, TRUE);
351 	check_word_boundaries_movement (TRUE, "aaaa ----", 4, 9, FALSE);
352 	check_word_boundaries_movement (TRUE, "aaaa ----", 5, 9, FALSE);
353 	check_word_boundaries_movement (TRUE, "aaaa ----", 6, 9, FALSE);
354 
355 	check_word_boundaries_movement (TRUE, "abcd", 2, 4, FALSE);
356 	check_word_boundaries_movement (TRUE, "abcd ", 2, 4, TRUE);
357 	check_word_boundaries_movement (TRUE, " abcd()", 0, 5, TRUE);
358 	check_word_boundaries_movement (TRUE, "abcd()efgh", 4, 6, TRUE);
359 
360 	check_word_boundaries_movement (TRUE, "ab ", 2, 2, FALSE);
361 	check_word_boundaries_movement (TRUE, "ab \n", 2, 2, FALSE);
362 	check_word_boundaries_movement (TRUE, "ab \ncd", 2, 6, FALSE);
363 
364 	check_word_boundaries_movement (TRUE, "--__--", 0, 2, TRUE);
365 	check_word_boundaries_movement (TRUE, "--__--", 2, 4, TRUE);
366 	check_word_boundaries_movement (TRUE, "--__--", 4, 6, FALSE);
367 }
368 
369 static void
test_backward_word_start(void)370 test_backward_word_start (void)
371 {
372 	check_word_boundaries_movement (FALSE, "aaaa ----", 9, 5, TRUE);
373 	check_word_boundaries_movement (FALSE, "aaaa ----", 8, 5, TRUE);
374 	check_word_boundaries_movement (FALSE, "aaaa ----", 5, 0, TRUE);
375 	check_word_boundaries_movement (FALSE, "aaaa ----", 4, 0, TRUE);
376 	check_word_boundaries_movement (FALSE, "aaaa ----", 3, 0, TRUE);
377 	check_word_boundaries_movement (FALSE, "---- aaaa", 9, 5, TRUE);
378 	check_word_boundaries_movement (FALSE, "---- aaaa", 8, 5, TRUE);
379 	check_word_boundaries_movement (FALSE, "---- aaaa", 5, 0, TRUE);
380 	check_word_boundaries_movement (FALSE, "---- aaaa", 4, 0, TRUE);
381 	check_word_boundaries_movement (FALSE, "---- aaaa", 3, 0, TRUE);
382 
383 	check_word_boundaries_movement (FALSE, "abcd", 2, 0, TRUE);
384 	check_word_boundaries_movement (FALSE, "()abcd ", 7, 2, TRUE);
385 	check_word_boundaries_movement (FALSE, "abcd()", 6, 4, TRUE);
386 	check_word_boundaries_movement (FALSE, "abcd()", 0, 0, FALSE);
387 
388 	check_word_boundaries_movement (FALSE, " cd", 1, 1, FALSE);
389 	check_word_boundaries_movement (FALSE, "\n cd", 2, 2, FALSE);
390 	check_word_boundaries_movement (FALSE, "ab\n cd", 4, 0, TRUE);
391 
392 	check_word_boundaries_movement (FALSE, "--__--", 6, 4, TRUE);
393 	check_word_boundaries_movement (FALSE, "--__--", 4, 2, TRUE);
394 	check_word_boundaries_movement (FALSE, "--__--", 2, 0, TRUE);
395 }
396 
397 static void
check_get_leading_spaces_end_boundary(const gchar * text,gint iter_offset,gint expected_leading_end_offset)398 check_get_leading_spaces_end_boundary (const gchar *text,
399 				       gint         iter_offset,
400 				       gint         expected_leading_end_offset)
401 {
402 	GtkTextBuffer *buffer;
403 	GtkTextIter iter;
404 	GtkTextIter leading_end;
405 
406 	buffer = gtk_text_buffer_new (NULL);
407 	gtk_text_buffer_set_text (buffer, text, -1);
408 
409 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, iter_offset);
410 	_gtk_source_iter_get_leading_spaces_end_boundary (&iter, &leading_end);
411 	g_assert_cmpint (gtk_text_iter_get_offset (&leading_end), ==, expected_leading_end_offset);
412 
413 	g_object_unref (buffer);
414 }
415 
416 static void
test_get_leading_spaces_end_boundary(void)417 test_get_leading_spaces_end_boundary (void)
418 {
419 	check_get_leading_spaces_end_boundary ("  abc\n", 0, 2);
420 	check_get_leading_spaces_end_boundary ("  \n", 0, 2);
421 	check_get_leading_spaces_end_boundary ("\t\n", 0, 1);
422 	check_get_leading_spaces_end_boundary ("\t\r\n", 0, 1);
423 	check_get_leading_spaces_end_boundary ("\t\r", 0, 1);
424 	check_get_leading_spaces_end_boundary (" \t \n", 0, 3);
425 
426 	/* No-Break Space U+00A0 */
427 	check_get_leading_spaces_end_boundary ("\302\240abc\n", 0, 1);
428 	check_get_leading_spaces_end_boundary (" \t\302\240\t\n", 0, 4);
429 
430 	/* Narrow No-Break Space U+202F */
431 	check_get_leading_spaces_end_boundary ("\342\200\257abc\n", 0, 1);
432 	check_get_leading_spaces_end_boundary ("\t \342\200\257\n", 0, 3);
433 }
434 
435 static void
check_get_trailing_spaces_start_boundary(const gchar * text,gint iter_offset,gint expected_trailing_start_offset)436 check_get_trailing_spaces_start_boundary (const gchar *text,
437 					  gint         iter_offset,
438 					  gint         expected_trailing_start_offset)
439 {
440 	GtkTextBuffer *buffer;
441 	GtkTextIter iter;
442 	GtkTextIter trailing_start;
443 
444 	buffer = gtk_text_buffer_new (NULL);
445 	gtk_text_buffer_set_text (buffer, text, -1);
446 
447 	gtk_text_buffer_get_iter_at_offset (buffer, &iter, iter_offset);
448 	_gtk_source_iter_get_trailing_spaces_start_boundary (&iter, &trailing_start);
449 	g_assert_cmpint (gtk_text_iter_get_offset (&trailing_start), ==, expected_trailing_start_offset);
450 
451 	g_object_unref (buffer);
452 }
453 
454 static void
test_get_trailing_spaces_start_boundary(void)455 test_get_trailing_spaces_start_boundary (void)
456 {
457 	check_get_trailing_spaces_start_boundary ("", 0, 0);
458 	check_get_trailing_spaces_start_boundary ("a", 0, 1);
459 	check_get_trailing_spaces_start_boundary ("a ", 0, 1);
460 	check_get_trailing_spaces_start_boundary ("a \n", 0, 1);
461 	check_get_trailing_spaces_start_boundary ("a \r\n", 0, 1);
462 	check_get_trailing_spaces_start_boundary ("a \r", 0, 1);
463 	check_get_trailing_spaces_start_boundary ("a\t\n", 0, 1);
464 	check_get_trailing_spaces_start_boundary (" \t\t  \n", 0, 0);
465 	check_get_trailing_spaces_start_boundary ("\n", 1, 1);
466 
467 	/* No-Break Space U+00A0 */
468 	check_get_trailing_spaces_start_boundary ("a\302\240", 0, 1);
469 	check_get_trailing_spaces_start_boundary ("a \t\302\240 \t\302\240", 0, 1);
470 
471 	/* Narrow No-Break Space U+202F */
472 	check_get_trailing_spaces_start_boundary ("a\342\200\257", 0, 1);
473 	check_get_trailing_spaces_start_boundary (" \ta;\t  \342\200\257 \t\302\240\n", 0, 4);
474 }
475 
476 int
main(int argc,char ** argv)477 main (int argc, char **argv)
478 {
479 	gtk_test_init (&argc, &argv);
480 
481 	g_test_add_func ("/Iter/full-word/forward", test_forward_full_word_end);
482 	g_test_add_func ("/Iter/full-word/backward", test_backward_full_word_start);
483 	g_test_add_func ("/Iter/full-word/starts", test_starts_full_word);
484 	g_test_add_func ("/Iter/full-word/ends", test_ends_full_word);
485 
486 	g_test_add_func ("/Iter/extra-natural-word/forward", test_forward_extra_natural_word_end);
487 	g_test_add_func ("/Iter/extra-natural-word/backward", test_backward_extra_natural_word_start);
488 	g_test_add_func ("/Iter/extra-natural-word/starts", test_starts_extra_natural_word);
489 	g_test_add_func ("/Iter/extra-natural-word/ends", test_ends_extra_natural_word);
490 
491 	g_test_add_func ("/Iter/custom-word/boundaries", test_word_boundaries);
492 	g_test_add_func ("/Iter/custom-word/forward", test_forward_word_end);
493 	g_test_add_func ("/Iter/custom-word/backward", test_backward_word_start);
494 
495 	g_test_add_func ("/Iter/get_leading_spaces_end_boundary", test_get_leading_spaces_end_boundary);
496 	g_test_add_func ("/Iter/get_trailing_spaces_start_boundary", test_get_trailing_spaces_start_boundary);
497 
498 	return g_test_run ();
499 }
500