changed a few tests

This commit is contained in:
chetz 2004-08-12 20:17:35 +00:00
parent 2bc4c06457
commit 8218b146f8
2 changed files with 26 additions and 12 deletions

View File

@ -46,13 +46,14 @@
(eq-match? (string-match (rx ("abcde")) test-string) (eq-match? (string-match (rx ("abcde")) test-string)
(string-match (rx ("edcba")) test-string)))) (string-match (rx ("edcba")) test-string))))
(add-test! 'null-match-by-any 'pattern-matching (add-test! 'any-test 'pattern-matching ;; fails only because of the case i = 0
(lambda () (lambda ()
(string-match (rx any) nul-string))) (let loop ((i 0))
(if (= 256 i)
(add-test! 'newline-match-by-any 'pattern-matching #t
(lambda () (if (string-match (rx any) (list->string (list (ascii->char i))))
(string-match (rx any) newln-string))) (loop (+ i 1))
#f)))))
(add-test! 'sequences-test 'pattern-matching (add-test! 'sequences-test 'pattern-matching
(lambda () (lambda ()

View File

@ -50,11 +50,11 @@
(read-line in-port 'concat)) (read-line in-port 'concat))
(equal? "zeile 2\n" (equal? "zeile 2\n"
(read-line in-port 'concat)) (read-line in-port 'concat))
(equal? "zeile 3\n" (equal? "zeile 3\004"
(read-line in-port 'concat)))) (read-line in-port 'concat))))
(make-string-input-port "zeile 1\nzeile 2\nzeile 3\n")))) ;; XXX klappt mit dem eof irgendwie nicht (make-string-input-port "zeile 1\nzeile 2\nzeile 3\004"))))
(add-test! 'read-line-split-test 'reading-delimited-strings (add-test! 'read-line-split-test 'reading-delimited-strings ;; XXX warum #\newline und nicht "\n"???
(lambda () (lambda ()
((lambda (in-port) ((lambda (in-port)
(and (call-with-values (lambda () (read-line in-port 'split)) (and (call-with-values (lambda () (read-line in-port 'split))
@ -65,8 +65,8 @@
(equal? b #\newline)))) (equal? b #\newline))))
(call-with-values (lambda () (read-line in-port 'split)) (call-with-values (lambda () (read-line in-port 'split))
(lambda (a b) (and (equal? a "zeile 3") (lambda (a b) (and (equal? a "zeile 3")
(equal? b #\newline)))))) (equal? b "\004")))))) ;; XXX geht nicht mit "\004" und nicht mit (ascii->char 4)!
(make-string-input-port "zeile 1\nzeile 2\nzeile 3\n")))) ;; XXX vorhin ging's hier noch - jetzt nicht mehr (\#eof) (make-string-input-port "zeile 1\nzeile 2\nzeile 3\004"))))
(add-test! 'read-paragraph-test 'reading-delimited-strings (add-test! 'read-paragraph-test 'reading-delimited-strings
(lambda () (lambda ()
@ -324,4 +324,17 @@
(lambda () (read-delimited char-digit? in-port 'split)) (lambda () (read-delimited char-digit? in-port 'split))
(lambda (a b) (and (equal? " nix\nzeile b1 x" a) (lambda (a b) (and (equal? " nix\nzeile b1 x" a)
(equal? #\2 b)))))) (equal? #\2 b))))))
(make-string-input-port "zeile a1 nix\nzeile b1 x2\nzeile c1 wieder nix\n")))) (make-string-input-port "zeile a1 nix\nzeile b1 x2\nzeile c1 wieder nix\n"))))
;; ===============================================================================================
(add-test! 'read-delimited!-with-char-set-test 'read-delimited-strings
(lambda ()
(let ((buf " "))
((lambda (in-port)
(read-delimited! (list->char-set (list #\a #\b #\1))
buf
in-port)
(equal? "zeile a "
buf))
(make-string-input-port "zeile a1 nix\nzeile b1 x2\nzeile c1 wieder nix\n")))))