Changeset 12127 in project


Ignore:
Timestamp:
10/08/08 14:44:31 (12 years ago)
Author:
felix winkelmann
Message:

bugfix, tests run (mostly)

Location:
chicken/branches/irregular/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/irregular/tests/test-irregex.scm

    r12126 r12127  
    22
    33
    4 (use test extras regex)
     4(use extras regex)
     5
     6(include "test.scm")
    57
    68(import irregex)
     
    4446        ((equal? "n" result)
    4547         (test-assert name (not (matcher pattern input))))
     48        ((equal? "y" result)
     49         (test-assert name (matcher pattern input)))
    4650        (else
    4751         (test-equal name
    4852                     (subst-matches (matcher pattern input) subst)
    49                      value)))))
     53                     result)))))
    5054   (string-split line "\t" #t)))
    5155
     
    7882
    7983(test-group "utils"
    80   (test "h*llo world"
    81       (irregex-replace "[aeiou]" "hello world" "*"))
    82   (test "h*ll* w*rld"
    83       (irregex-replace/all "[aeiou]" "hello world" "*")))
     84  (test-equal "replace"
     85      (irregex-replace "[aeiou]" "hello world" "*")
     86      "h*llo world")
     87  (test-equal "replace/all"
     88      (irregex-replace/all "[aeiou]" "hello world" "*")
     89      "h*ll* w*rld"))
    8490
    8591(test-end)
  • chicken/branches/irregular/tests/test.scm

    r12126 r12127  
    77(define *fail* 0)
    88(define *start* 0)
    9 (define *fail-token* (gensym))
     9(define *fail-token* (string->uninterned-symbol "error"))
    1010
    1111(define (run-test name thunk expect eq pass-msg fail-msg)
     
    8080    ((_ name expr value) (run-equal name (lambda () expr) value equal?))))
    8181
     82(define-syntax test-assert
     83  (syntax-rules ()
     84    ((_ name expr) (run-equal name (lambda () (if expr #t #f)) #t eq?))))
     85
    8286(define-syntax test-error
    8387  (syntax-rules ()
     
    8589     (run-equal
    8690      name
    87       (lambda () (handle-exceptions ex *fail-token* expr)) *fail-token* eq?) )
     91      (lambda () (handle-exceptions ex *fail-token* expr))
     92      *fail-token* eq?) )
    8893    ((_ expr) (test-error 'expr expr))))
    8994
     
    9196  (syntax-rules ()
    9297    ((_ name body ...)
    93      (begin body ...))))
     98     (begin
     99       (print "\n" name ":\n")
     100       body ...))))
Note: See TracChangeset for help on using the changeset viewer.