/usr/share/scheme48-1.9/posix/regexp-check.scm is in scheme48 1.9-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ; Part of Scheme 48 1.9. See file COPYING for notices and license.
; Authors: Richard Kelsey, Jonathan Rees, Mike Sperber
(define-test-suite regexp-tests)
(define-test-case any-match? regexp-tests
(check (any-match? (text "abc") "abc"))
(check (not (any-match? (text "abc") "abx")))
(check (any-match? (text "abc") "xxabcxx")))
(define-test-case exact-match regexp-tests
(check (exact-match? (text "abc") "abc"))
(check (not (exact-match? (text "abc") "abx")))
(check (not (exact-match? (text "abc") "xxabcxx"))))
(define (pair-match exp string)
(let ((res (match exp string)))
(and res
(cons (list (match-start res)
(match-end res))
(map (lambda (p)
(cons (car p)
(list (match-start (cdr p))
(match-end (cdr p)))))
(match-submatches res))))))
(define-test-case match regexp-tests
(check (pair-match (text "abc") "abc")
=> '((0 3)))
(check-that (pair-match (text "abc") "abx") (is-false))
(check (pair-match (text "abc") "xxabcxx")
=> '((2 5)))
(check (pair-match (sequence (text "ab")
(submatch 'foo (text "cd"))
(text "ef"))
"xxxabcdefxx")
=> '((3 9) (foo 5 7)))
(check (pair-match (sequence (set "a")
(one-of (submatch 'foo (text "bc"))
(submatch 'bar (text "BC"))))
"xxxaBCd")
=> '((3 6) (bar 4 6))))
|