diff --git a/collects/tests/r6rs/base.sls b/collects/tests/r6rs/base.sls index 50bcf669e6..39525229fb 100644 --- a/collects/tests/r6rs/base.sls +++ b/collects/tests/r6rs/base.sls @@ -62,11 +62,11 @@ (syntax-rules () [(_ op) (begin - (test/exn (op 1 0) &assertion) - (test/exn (op 1 0.0) &assertion) - (test/exn (op +inf.0 1) &assertion) - (test/exn (op -inf.0 1) &assertion) - (test/exn (op +nan.0 1) &assertion))])) + (test/unspec-flonum-or-exn (op 1 0) &assertion) + (test/unspec-flonum-or-exn (op 1 0.0) &assertion) + (test/unspec-flonum-or-exn (op +inf.0 1) &assertion) + (test/unspec-flonum-or-exn (op -inf.0 1) &assertion) + (test/unspec-flonum-or-exn (op +nan.0 1) &assertion))])) (define-syntax test-string-to-number (syntax-rules () @@ -924,7 +924,7 @@ (for-each (lambda (n) (test (string->number (number->string n)) n) - (test (string->number (number->string n 10 5)) n) + (test (string->number (number->string (inexact n) 10 5)) (inexact n)) (when (exact? n) (test (string->number (number->string n 16) 16) n) (test (string->number (string-append "#x" (number->string n 16))) n) diff --git a/collects/tests/r6rs/io/ports.sls b/collects/tests/r6rs/io/ports.sls index e49a3c8e12..ad12c2191f 100644 --- a/collects/tests/r6rs/io/ports.sls +++ b/collects/tests/r6rs/io/ports.sls @@ -342,16 +342,15 @@ (close-port p)) (let ([p (open-file-input-port "io-tmp1")]) (let ([b1 (get-u8 p)]) - (if (= b1 #xFE) - (begin - (test (get-u8 p) #xFF) - (test (get-u8 p) 0) - (test (get-u8 p) 97)) - (begin - (test b1 #xFF) - (test (get-u8 p) #xFE) - (test (get-u8 p) 97) - (test (get-u8 p) 0)))) + (cond + [(equal? b1 #xFE) + (test (get-u8 p) #xFF) + (test (get-u8 p) 0) + (test (get-u8 p) 97)] + [(equal? b1 #xFF) + (test (get-u8 p) #xFE) + (test (get-u8 p) 97) + (test (get-u8 p) 0)])) (test/unspec (close-port p))) (let ([bytevector->string-via-file @@ -566,20 +565,24 @@ (lambda () pos) (lambda (p) (set! pos p)) (lambda () 'ok))]) - (test (port-position p) 0) + (test/unspec (port-position p)) (test (get-string-n p 3) "abc") - (test (port-position p) 3) - (test (lookahead-char p) #\d) - (test (lookahead-char p) #\d) - (test (port-position p) 3) - (test/unspec (set-port-position! p 10)) - (get-string-n p 2) - (test (get-string-n p 2) "mn") - (test (get-string-n p 2) "op") - (test (get-string-n p 2) (eof-object)) - (test/unspec (set-port-position! p 2)) - (test (get-string-n p 3) "cde") - (test/unspec (close-port p))) + (let ([pos3 (port-position p)]) + (test (lookahead-char p) #\d) + (test (lookahead-char p) #\d) + (test (port-position p) pos3) + (test (get-string-n p 7) "defghij") + (let ([pos10 (port-position p)]) + (get-string-n p 2) + (test (get-string-n p 2) "mn") + (test/unspec (set-port-position! p pos10)) + (get-string-n p 2) + (test (get-string-n p 2) "mn")) + (test (get-string-n p 2) "op") + (test (get-string-n p 2) (eof-object)) + (test/unspec (set-port-position! p pos3)) + (test (get-string-n p 3) "def") + (test/unspec (close-port p)))) (test-positions make-custom-textual-input-port) diff --git a/collects/tests/r6rs/lists.sls b/collects/tests/r6rs/lists.sls index 87218cc0e3..91a3b602d5 100644 --- a/collects/tests/r6rs/lists.sls +++ b/collects/tests/r6rs/lists.sls @@ -15,7 +15,7 @@ (test (for-all even? '()) #t) (test (for-all even? '(3 1 4 1 5 9)) #f) - (test (for-all even? '(3 1 4 1 5 9 . 2)) #f) + ;; (test (for-all even? '(3 1 4 1 5 9 . 2)) #f) ; removed from R6RS (test (for-all even? '(2 4 14)) #t) (test/exn (for-all even? '(2 4 14 . 9)) &assertion) (test (for-all (lambda (n) (and (even? n) n)) @@ -121,7 +121,7 @@ (test (for-all (lambda (x) x) '(12 14)) 14) (test (for-all (lambda (x) x) '(12)) 12) (test (for-all (lambda (x) x) '()) #t) - (test (for-all even? '(13 . 14)) #f) + ;; (test (for-all even? '(13 . 14)) #f) ; removed from R6RS (test (for-all cons '(1 2 3) '(a b c)) '(3 . c)) (test (for-all (lambda (a b) (= a 1)) '(1 2 3) '(a b c)) #f) ;; R6RS merely says that this *should* work, but not must: diff --git a/collects/tests/r6rs/test.sls b/collects/tests/r6rs/test.sls index cb9bf479db..19dae25955 100644 --- a/collects/tests/r6rs/test.sls +++ b/collects/tests/r6rs/test.sls @@ -9,6 +9,7 @@ test/output test/unspec test/unspec-or-exn + test/unspec-flonum-or-exn test/output/unspec run-test report-test-results) @@ -123,6 +124,19 @@ (begin expr 'unspec)) 'unspec)])) + (define-syntax test/unspec-flonum-or-exn + (syntax-rules () + [(_ expr condition) + (test (guard (c [((condition-predicate (record-type-descriptor condition)) c) + 'unspec-or-flonum]) + (let ([v expr]) + (if (flonum? v) + 'unspec-or-flonum + (if (eq? v 'unspec-or-flonum) + (list v) + v)))) + 'unspec-or-flonum)])) + (define-syntax test/output/unspec (syntax-rules () [(_ expr str)