summaryrefslogtreecommitdiff
path: root/test-suite/tests/regexp.test
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-09-10 22:33:40 +0200
committerLudovic Courtès <ludo@gnu.org>2008-09-10 22:33:40 +0200
commit4a4849dbe0ae1b731b408167f90222e05d1ca2bd (patch)
treecaa909b99ffb221e43408a3d19ad3e8209e3a96b /test-suite/tests/regexp.test
parent3ec17f28b8f96fa43218db83656c0d85b4f69d7c (diff)
parent032913739218c756f673bfb9c8f66ef9f8f02330 (diff)
downloadguile-4a4849dbe0ae1b731b408167f90222e05d1ca2bd.tar.gz
Merge commit '032913739218c756f673bfb9c8f66ef9f8f02330' into boehm-demers-weiser-gc
Conflicts: libguile/gc.c libguile/srcprop.c libguile/srcprop.h
Diffstat (limited to 'test-suite/tests/regexp.test')
-rw-r--r--test-suite/tests/regexp.test34
1 files changed, 33 insertions, 1 deletions
diff --git a/test-suite/tests/regexp.test b/test-suite/tests/regexp.test
index 7e7914534..3050af39b 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 Free Software Foundation, Inc.
+;;;; Copyright (C) 1999, 2004, 2006, 2007 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
@@ -71,6 +71,38 @@
(string=? "foo" (match:string (string-match ".*" "foo" 1)))))
;;;
+;;; regexp-exec
+;;;
+
+(with-test-prefix "regexp-exec"
+
+ (pass-if-exception "non-integer offset" exception:wrong-type-arg
+ (let ((re (make-regexp "ab+")))
+ (regexp-exec re "aaaabbbb" 1.5 'bogus-flags-arg)))
+
+ (pass-if-exception "non-string input" exception:wrong-type-arg
+ (let ((re (make-regexp "ab+")))
+ (regexp-exec re 'not-a-string)))
+
+ (pass-if-exception "non-string input, with offset" exception:wrong-type-arg
+ (let ((re (make-regexp "ab+")))
+ (regexp-exec re 'not-a-string 5)))
+
+ ;; in guile 1.8.1 and earlier, a #\nul character in the input string was
+ ;; only detected in a critical section, and the resulting error throw
+ ;; abort()ed the program
+ (pass-if-exception "nul in input" exception:string-contains-nul
+ (let ((re (make-regexp "ab+")))
+ (regexp-exec re (string #\a #\b (integer->char 0)))))
+
+ ;; in guile 1.8.1 and earlier, a bogus flags argument was only detected
+ ;; inside a critical section, and the resulting error throw abort()ed the
+ ;; program
+ (pass-if-exception "non-integer flags" exception:wrong-type-arg
+ (let ((re (make-regexp "ab+")))
+ (regexp-exec re "aaaabbbb" 0 'bogus-flags-arg))))
+
+;;;
;;; regexp-quote
;;;