[glib] regex test: do not assert that system PCRE still has an 8.31 bug



commit ace7846322634159271c5c75ccadfa3cade78620
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Apr 28 10:10:58 2015 +0100

    regex test: do not assert that system PCRE still has an 8.31 bug
    
    This was fixed in 8.32, so if we have that version, assert that it is
    fixed; if we don't (e.g. the current internal pcre), still don't
    assert that it *isn't* fixed.
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=733325
    Reviewed-by: Christian Persch <chpe gnome org>
    Signed-off-by: Simon McVittie <simon mcvittie collabora co uk>

 glib/tests/regex.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index b886b06..5e5b88d 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -25,6 +25,12 @@
 #include <locale.h>
 #include "glib.h"
 
+#ifdef USE_SYSTEM_PCRE
+#include <pcre.h>
+#else
+#include "glib/pcre/pcre.h"
+#endif
+
 /* U+20AC EURO SIGN (symbol, currency) */
 #define EURO "\xe2\x82\xac"
 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE (letter, lowercase) */
@@ -2446,8 +2452,12 @@ main (int argc, char *argv[])
   /* Test that othercasing in our pcre/glib integration is bug-for-bug compatible
    * with pcre's internal tables. Bug #678273 */
   TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "DŽ", -1, 0, 0, TRUE);
-  TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "Dž", -1, 0, 0, FALSE);
   TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "dž", -1, 0, 0, TRUE);
+#if PCRE_MAJOR > 8 || (PCRE_MAJOR == 8 && PCRE_MINOR >= 32)
+  /* This would incorrectly fail to match in pcre < 8.32, so only assert
+   * this for known-good pcre. */
+  TEST_MATCH("[DŽ]", G_REGEX_CASELESS, 0, "Dž", -1, 0, 0, TRUE);
+#endif
 
   /* TEST_MATCH_NEXT#(pattern, string, string_len, start_position, ...) */
   TEST_MATCH_NEXT0("a", "x", -1, 0);


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