use 'infinity instead of +inf.0 for pretty-print

fix error messages to use ~e instead of ~s

svn: r11887
This commit is contained in:
Eli Barzilay 2008-09-27 02:19:47 +00:00
parent 4efab4f12f
commit 856fb22152
2 changed files with 12 additions and 12 deletions

View File

@ -36,7 +36,7 @@
(path->string (current-directory)))]) (path->string (current-directory)))])
(if m (if m
(cadr m) (cadr m)
(error* "internal error: unexpected directory name: ~a" (error* "internal error: unexpected directory name: \"~a\""
(current-directory))))) (current-directory)))))
(provide user-data) (provide user-data)
@ -78,7 +78,7 @@
(let ([line (bytes->string/utf-8 line)]) (let ([line (bytes->string/utf-8 line)])
(unless (or (< (string-length line) len) (unless (or (< (string-length line) len)
(< (string-width line) len)) (< (string-width line) len))
(error* "~a \"~a\" in ~a is longer than ~a characters" (error* "~a \"~a\" in \"~a\" is longer than ~a characters"
(if n (format "Line #~a" n) "The line") (if n (format "Line #~a" n) "The line")
(regexp-replace #rx"^[ \t]*(.*?)[ \t]*$" line "\\1") (regexp-replace #rx"^[ \t]*(.*?)[ \t]*$" line "\\1")
(currently-processed-file-name) (currently-processed-file-name)
@ -164,7 +164,7 @@
[line (if (and untabify? (regexp-match? #rx"\t" line)) [line (if (and untabify? (regexp-match? #rx"\t" line))
(untabify line) line)]) (untabify line) line)])
(when (and bad-re (regexp-match? bad-re line)) (when (and bad-re (regexp-match? bad-re line))
(error* "You cannot use \"~a\" in ~a!~a" (error* "You cannot use \"~a\" in \"~a\"!~a"
(if (regexp? bad-re) (object-name bad-re) bad-re) (if (regexp? bad-re) (object-name bad-re) bad-re)
(currently-processed-file-name) (currently-processed-file-name)
(if textualize? "" (format " (line ~a)" n)))) (if textualize? "" (format " (line ~a)" n))))
@ -546,7 +546,7 @@
;; "`textualize?' and `coverage?'"] ;; "`textualize?' and `coverage?'"]
[else #f])]) [else #f])])
(when bad (when bad
(error* "bad checker specifications: ~a" bad))) (error* "bad checker specifications: ~e" bad)))
;; ======================================== ;; ========================================
(list pre check post)))))]))) (list pre check post)))))])))
@ -657,7 +657,7 @@
;; expected to be used only with identifiers ;; expected to be used only with identifiers
(begin (with-handlers ([exn:fail:contract:variable? (begin (with-handlers ([exn:fail:contract:variable?
(lambda (_) (lambda (_)
(error* "missing binding: ~a" (->disp 'id)))]) (error* "missing binding: ~e" (->disp 'id)))])
((submission-eval) `id)) ((submission-eval) `id))
...)) ...))
@ -666,14 +666,14 @@
(syntax-rules () (syntax-rules ()
[(_ expr) [(_ expr)
(unless (procedure? ((submission-eval) `expr)) (unless (procedure? ((submission-eval) `expr))
(error* "~a is expected to be bound to a procedure" (->disp 'expr)))] (error* "~e is expected to be bound to a procedure" (->disp 'expr)))]
[(_ expr arity) [(_ expr arity)
(let ([ar arity] (let ([ar arity]
[val ((submission-eval) `expr)]) [val ((submission-eval) `expr)])
(unless (procedure? val) (unless (procedure? val)
(error* "~a is expected to be bound to a procedure" (->disp 'expr))) (error* "~e is expected to be bound to a procedure" (->disp 'expr)))
(unless (procedure-arity-includes? val ar) (unless (procedure-arity-includes? val ar)
(error* "~a is expected to be bound to a procedure of ~s arguments" (error* "~e is expected to be bound to a procedure of ~s arguments"
(->disp 'expr) ar)))])) (->disp 'expr) ar)))]))
(define-syntax !procedure (define-syntax !procedure
(syntax-rules () (syntax-rules ()
@ -683,7 +683,7 @@
(provide !integer* !integer) (provide !integer* !integer)
(define-syntax-rule (!integer* expr) (define-syntax-rule (!integer* expr)
(unless (integer? ((submission-eval) `expr)) (unless (integer? ((submission-eval) `expr))
(error* "~a is expected to be bound to an integer" (->disp 'expr)))) (error* "~e is expected to be bound to an integer" (->disp 'expr))))
(define-syntax-rule (!integer id) (define-syntax-rule (!integer id)
(begin (!defined id) (!integer* id))) (begin (!defined id) (!integer* id)))
@ -695,12 +695,12 @@
(syntax-rules () (syntax-rules ()
[(_ expr) [(_ expr)
(unless ((submission-eval) `expr) (unless ((submission-eval) `expr)
(error* "your code failed a test: ~a is false" (->disp 'expr)))] (error* "your code failed a test: ~e is false" (->disp 'expr)))]
[(_ expr result) (!test expr result equal?)] [(_ expr result) (!test expr result equal?)]
[(_ expr result equal?) [(_ expr result equal?)
(let ([val ((submission-eval) `expr)]) (let ([val ((submission-eval) `expr)])
(unless (equal? result val) (unless (equal? result val)
(error* "your code failed a test: ~a evaluated to ~a, expecting ~a" (error* "your code failed a test: ~e evaluated to ~e, expecting ~e"
(->disp 'expr) (->disp val) (->disp result))))])) (->disp 'expr) (->disp val) (->disp result))))]))
(provide !all-covered) (provide !all-covered)

View File

@ -154,7 +154,7 @@
(parameterize ([pretty-print-show-inexactness #t] (parameterize ([pretty-print-show-inexactness #t]
[pretty-print-.-symbol-without-bars #t] [pretty-print-.-symbol-without-bars #t]
[pretty-print-exact-as-decimal #t] [pretty-print-exact-as-decimal #t]
[pretty-print-columns +inf.0] [pretty-print-columns 'infinity]
[read-case-sensitive #t]) [read-case-sensitive #t])
(let ([p (open-output-string)]) (let ([p (open-output-string)])
(pretty-print (value-converter v) p) (pretty-print (value-converter v) p)