1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-18 10:10:23 +02:00

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.
This commit is contained in:
Ludovic Courtès 2008-09-25 21:07:06 +02:00
parent be5c4a82ab
commit afb28ce860
3 changed files with 27 additions and 3 deletions

View file

@ -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
@ -102,6 +102,29 @@
(let ((re (make-regexp "ab+")))
(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
;;;