[gtksourceview] A small regex unit test
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] A small regex unit test
- Date: Sun, 13 Jan 2013 21:08:18 +0000 (UTC)
commit 4d1a0a2f3c2daf6f65b4c3e07e9f76013a78e529
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jan 13 18:44:50 2013 +0100
A small regex unit test
tests/Makefile.am | 7 +++++++
tests/test-regex.c | 24 ++++++++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8712473..d91a735 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -58,6 +58,13 @@ test_buffer_LDADD = \
$(DEP_LIBS) \
$(TESTS_LIBS)
+UNIT_TEST_PROGS += test-regex
+test_regex_SOURCES = test-regex.c
+test_regex_LDADD = \
+ $(top_builddir)/gtksourceview/libgtksourceview-private.la \
+ $(DEP_LIBS) \
+ $(TESTS_LIBS)
+
UNIT_TEST_PROGS += test-completion-model
test_completion_model_SOURCES = test-completion-model.c
test_completion_model_LDADD = \
diff --git a/tests/test-regex.c b/tests/test-regex.c
new file mode 100644
index 0000000..c03d305
--- /dev/null
+++ b/tests/test-regex.c
@@ -0,0 +1,24 @@
+#include <gtk/gtk.h>
+#include <gtksourceview/gtksource.h>
+#include "gtksourceview/gtksourceregex.h"
+
+static void
+test_slash_c_pattern (void)
+{
+ GtkSourceRegex *regex;
+ GError *error = NULL;
+
+ regex = _gtk_source_regex_new ("\\C", 0, &error);
+ g_assert_error (error, G_REGEX_ERROR, G_REGEX_ERROR_COMPILE);
+ g_assert (regex == NULL);
+}
+
+int
+main (int argc, char** argv)
+{
+ gtk_test_init (&argc, &argv);
+
+ g_test_add_func ("/Regex/slash-c", test_slash_c_pattern);
+
+ return g_test_run();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]