[glib] Add a testcase for bug 640489



commit a46885242b3566a7f6afa4ca5cf5d3ffcf3d977d
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Feb 15 00:02:13 2011 -0500

    Add a testcase for bug 640489

 glib/tests/regex.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index ef3ac68..2befb1a 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -2059,6 +2059,30 @@ test_recursion (void)
   g_regex_unref (regex);
 }
 
+static void
+test_multiline (void)
+{
+  GRegex *regex;
+  GMatchInfo *info;
+  gint count;
+
+  g_test_bug ("640489");
+
+  regex = g_regex_new ("^a$", G_REGEX_MULTILINE|G_REGEX_DOTALL, 0, NULL);
+
+  count = 0;
+  g_regex_match (regex, "a\nb\na", 0, &info);
+  while (g_match_info_matches (info))
+    {
+      count++;
+      g_match_info_next (info, NULL);
+    }
+  g_match_info_free (info);
+  g_regex_unref (regex);
+
+  g_assert_cmpint (count, ==, 2);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -2066,6 +2090,8 @@ main (int argc, char *argv[])
 
   g_test_init (&argc, &argv, NULL);
 
+  g_test_bug_base ("http://bugzilla.gnome.org/";);
+
   g_test_add_func ("/regex/basic", test_basic);
   g_test_add_func ("/regex/compile", test_compile);
   g_test_add_func ("/regex/properties", test_properties);
@@ -2075,6 +2101,7 @@ main (int argc, char *argv[])
   g_test_add_func ("/regex/subpattern", test_subpattern);
   g_test_add_func ("/regex/condition", test_condition);
   g_test_add_func ("/regex/recursion", test_recursion);
+  g_test_add_func ("/regex/multiline", test_multiline);
 
   /* TEST_NEW(pattern, compile_opts, match_opts) */
   TEST_NEW("", 0, 0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]