summaryrefslogtreecommitdiff
path: root/test-suite/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-09-25 21:07:06 +0200
committerLudovic Courtès <ludo@gnu.org>2008-09-25 21:07:06 +0200
commitc6333102655783c91b3ce733dde7ce79b362e1cf (patch)
treef48f71b0862b4928c2bde8eccd23edcaee1b98ce /test-suite/tests
parentfb2f8886c4d537b0c7d3e9e78a8d4e5e272a36f4 (diff)
downloadguile-c6333102655783c91b3ce733dde7ce79b362e1cf.tar.gz
Fix handling of the FLAGS argument in `fold-matches'.
* ice-9/regex.scm (fold-matches): If FLAGS is non-null, use `(car flags)', not `flags'. * test-suite/tests/regexp.test ("fold-matches"): New test prefix. * NEWS: Update.
Diffstat (limited to 'test-suite/tests')
-rw-r--r--test-suite/tests/regexp.test25
1 files changed, 24 insertions, 1 deletions
diff --git a/test-suite/tests/regexp.test b/test-suite/tests/regexp.test
index 3050af39b..0ca0203b6 100644
--- a/test-suite/tests/regexp.test
+++ b/test-suite/tests/regexp.test
@@ -1,7 +1,7 @@
;;;; regexp.test --- test Guile's regular expression functions -*- scheme -*-
;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
;;;;
-;;;; Copyright (C) 1999, 2004, 2006, 2007 Free Software Foundation, Inc.
+;;;; Copyright (C) 1999, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -103,6 +103,29 @@
(regexp-exec re "aaaabbbb" 0 'bogus-flags-arg))))
;;;
+;;; fold-matches
+;;;
+
+(with-test-prefix "fold-matches"
+
+ (pass-if "without flags"
+ (equal? '("hello")
+ (fold-matches "^[a-z]+$" "hello" '()
+ (lambda (match result)
+ (cons (match:substring match)
+ result)))))
+
+ (pass-if "with flags"
+ ;; Prior to 1.8.6, passing an additional flag would not work.
+ (null?
+ (fold-matches "^[a-z]+$" "hello" '()
+ (lambda (match result)
+ (cons (match:substring match)
+ result))
+ (logior regexp/notbol regexp/noteol)))))
+
+
+;;;
;;; regexp-quote
;;;