[glib] gregex: loosen behaviour testing
- From: Allison Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gregex: loosen behaviour testing
- Date: Tue, 16 Aug 2016 08:42:08 +0000 (UTC)
commit 6d1178b2d923963588bc3430a1de49eb9fc8bc89
Author: Allison Lortie <desrt desrt ca>
Date: Tue Aug 9 12:46:30 2016 +0200
gregex: loosen behaviour testing
Circa 8.38, upstream PCRE (intentionally?) changed behaviour with
respect to whether options set with expressions like "(?i)" at the
top-level were reported via the pcre_fullinfo() API as having been
requested during compilation.
GLib contained a test that verified that these options were indeed
reported as if they had been provided as flags on the API.
Remove that check, and document the no-longer-deterministic behaviour.
https://bugzilla.gnome.org/show_bug.cgi?id=767240
glib/gregex.c | 4 ++++
glib/tests/regex.c | 13 ++++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/glib/gregex.c b/glib/gregex.c
index 325f8d2..0cfe639 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -1582,6 +1582,10 @@ g_regex_get_max_lookbehind (const GRegex *regex)
*
* Returns the compile options that @regex was created with.
*
+ * Depending on the version of PCRE that is used, this may or may not
+ * include flags set by option expressions such as `(?i)` found at the
+ * top-level within the compiled pattern.
+ *
* Returns: flags from #GRegexCompileFlags
*
* Since: 2.26
diff --git a/glib/tests/regex.c b/glib/tests/regex.c
index bd42230..a597214 100644
--- a/glib/tests/regex.c
+++ b/glib/tests/regex.c
@@ -2218,17 +2218,16 @@ main (int argc, char *argv[])
TEST_NEW("(?P<A>x)|(?P<A>y)", G_REGEX_DUPNAMES | G_REGEX_OPTIMIZE, 0);
/* This gives "internal error: code overflow" with pcre 6.0 */
TEST_NEW("(?i)(?-i)", 0, 0);
+ TEST_NEW ("(?i)a", 0, 0);
+ TEST_NEW ("(?m)a", 0, 0);
+ TEST_NEW ("(?s)a", 0, 0);
+ TEST_NEW ("(?x)a", 0, 0);
+ TEST_NEW ("(?J)a", 0, 0);
+ TEST_NEW ("(?U)[a-z]+", 0, 0);
- /* Check that flags are correct if the pattern modifies them */
/* TEST_NEW_CHECK_FLAGS(pattern, compile_opts, match_ops, real_compile_opts, real_match_opts) */
TEST_NEW_CHECK_FLAGS ("a", G_REGEX_OPTIMIZE, 0, G_REGEX_OPTIMIZE, 0);
TEST_NEW_CHECK_FLAGS ("a", G_REGEX_RAW, 0, G_REGEX_RAW, 0);
- TEST_NEW_CHECK_FLAGS ("(?i)a", 0, 0, G_REGEX_CASELESS, 0);
- TEST_NEW_CHECK_FLAGS ("(?m)a", 0, 0, G_REGEX_MULTILINE, 0);
- TEST_NEW_CHECK_FLAGS ("(?s)a", 0, 0, G_REGEX_DOTALL, 0);
- TEST_NEW_CHECK_FLAGS ("(?x)a", 0, 0, G_REGEX_EXTENDED, 0);
- TEST_NEW_CHECK_FLAGS ("(?J)a", 0, 0, G_REGEX_DUPNAMES, 0);
- TEST_NEW_CHECK_FLAGS ("(?U)[a-z]+", 0, 0, G_REGEX_UNGREEDY, 0);
TEST_NEW_CHECK_FLAGS ("(?X)a", 0, 0, 0 /* not exposed by GRegex */, 0);
TEST_NEW_CHECK_FLAGS ("^.*", 0, 0, G_REGEX_ANCHORED, 0);
TEST_NEW_CHECK_FLAGS ("(*UTF8)a", 0, 0, 0 /* this is the default in GRegex */, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]