Changeset 12817 in project


Ignore:
Timestamp:
12/14/08 23:11:39 (12 years ago)
Author:
azul
Message:

Adjust old tests to use the new test-embedded semantics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/svnwiki-mail/trunk/svnwiki-mail.scm

    r12799 r12817  
    744744; Some test cases:
    745745
    746 (when (getenv "SVNWIKI_UNITTESTS")
    747   (assert (string=? (mail-page->id #f "foo" (constantly stream-null)) "foo"))
    748   (assert (string=? (mail-page->id #f "foo/bar hey/there & you" (constantly stream-null)) "foo/barhey/thereyou"))
    749   (assert (string=? (mail-page->id #f "foo"
    750                                    (lambda (x)
    751                                      (assert (string=? x "foo"))
    752                                      (stream (vector "foo"))))
    753                     "foo"))
    754   (assert (string=? (mail-page->id #f "foo"
    755                                    (lambda (x)
    756                                      (cond
    757                                        ((string=? x "foo") (stream (vector "f o o")))
    758                                        ((string=? x "foo-0") (stream (vector "f oo")))
    759                                        (else stream-null))))
    760                     "foo-1")))
     746(test-group mail-page->id
     747  (test (mail-page->id #f "foo-bar/quux" (constantly stream-null)) "foo-bar/quux")
     748  (test (mail-page->id #f "foo/bar hey/there & you" (constantly stream-null)) "foo/barhey/thereyou")
     749  (test (mail-page->id #f "foo"
     750                       (lambda (x)
     751                         (assert (string=? x "foo"))
     752                         (stream (vector "foo"))))
     753        "foo")
     754  (test (mail-page->id #f "f&oo"
     755                       (lambda (x)
     756                         (cond
     757                           ((string=? x "foo") (stream (vector "f o o")))
     758                           ((string=? x "foo-0") (stream (vector "f oo")))
     759                           (else stream-null))))
     760        "foo-1"))
    761761
    762762(define (list-subscribers env path)
     
    813813    str))
    814814
    815 (when (getenv "SVNWIKI_UNITTESTS")
    816   (let ((test (lambda (input output)
    817                 (assert (not (stream-length>= (stream-string-max (string->stream input) 10) 11)))
    818                 (assert (stream= char=? (stream-string-max (string->stream input) 10) (string->stream output))))))
    819     (test "" "")
    820     (test "foobar" "foobar")
    821     (test "012345678" "012345678")
    822     (test "0123456789" "0123456789")
    823     (test "01234567890" "0123456...")))
     815(define (stream-string-max-test str)
     816  (stream->string (stream-string-max (string->stream str) 10)))
     817
     818(test-group stream-string-max
     819  (test (stream-string-max-test "") "")
     820  (test (stream-string-max-test "foobar") "foobar")
     821  (test (stream-string-max-test "012345678") "012345678")
     822  (test (stream-string-max-test "0123456789") "0123456789")
     823  (test (stream-string-max-test "01234567890") "0123456..."))
    824824
    825825; type is either 'add, 'modify or 'delete.
Note: See TracChangeset for help on using the changeset viewer.