Add two spaces before contract error message fields (Reference section 9.2.1).
This commit is contained in:
parent
3cb555a6c1
commit
eb12d76769
|
@ -153,7 +153,7 @@
|
|||
(define (add-indent s)
|
||||
(if (null? so-far)
|
||||
s
|
||||
(string-append "\n " s)))
|
||||
(string-append "\n " s)))
|
||||
(define nxt
|
||||
(cond
|
||||
[(eq? 'given: fst) (add-indent
|
||||
|
@ -190,13 +190,13 @@
|
|||
(for/list ([context (in-list context)]
|
||||
[n (in-naturals)])
|
||||
(format (if (zero? n)
|
||||
" in: ~a\n"
|
||||
" ~a\n")
|
||||
" in: ~a\n"
|
||||
" ~a\n")
|
||||
context)))))
|
||||
(define contract-line (show/write (blame-contract blme) #:alone? #t))
|
||||
(define at-line (if (string=? source-message "")
|
||||
#f
|
||||
(format " at: ~a" source-message)))
|
||||
(format " at: ~a" source-message)))
|
||||
|
||||
(define self-or-not (if (blame-original? blme)
|
||||
"broke its contract"
|
||||
|
@ -215,11 +215,11 @@
|
|||
(define blaming-line
|
||||
(cond
|
||||
[(null? (cdr blame-parties))
|
||||
(format " blaming: ~a" (convert-blame-singleton (car blame-parties)))]
|
||||
(format " blaming: ~a" (convert-blame-singleton (car blame-parties)))]
|
||||
[else
|
||||
(apply
|
||||
string-append
|
||||
" blaming multiple parties:"
|
||||
" blaming multiple parties:"
|
||||
(for/list ([party (in-list blame-parties)])
|
||||
(format "\n ~a" (convert-blame-singleton party))))]))
|
||||
|
||||
|
@ -228,11 +228,11 @@
|
|||
(let ([from-positive-message
|
||||
(show/display
|
||||
(from-info (blame-positive blme)))])
|
||||
(format " contract from: ~a" from-positive-message))
|
||||
(format " contract from: ~a" from-positive-message))
|
||||
(let ([from-negative-message
|
||||
(show/display
|
||||
(from-info (blame-negative blme)))])
|
||||
(format " contract from: ~a" from-negative-message))))
|
||||
(format " contract from: ~a" from-negative-message))))
|
||||
|
||||
(combine-lines
|
||||
start-of-message
|
||||
|
@ -241,7 +241,7 @@
|
|||
(if context-lines
|
||||
contract-line
|
||||
(string-append
|
||||
" in:"
|
||||
" in:"
|
||||
(substring contract-line 5 (string-length contract-line))))
|
||||
from-line
|
||||
blaming-line
|
||||
|
|
|
@ -1819,7 +1819,7 @@ the @racket[b] argument has been swapped or not (see @racket[blame-swap]).
|
|||
|
||||
If @racket[fmt] contains the symbols @racket['given:] or @racket['expected:],
|
||||
they are replaced like @racket['given:] and @racket['expected:] are, but
|
||||
the replacements are prefixed with the string @racket["\n "] to conform
|
||||
the replacements are prefixed with the string @racket["\n "] to conform
|
||||
to the error message guidelines in @secref["err-msg-conventions"].
|
||||
|
||||
}
|
||||
|
|
|
@ -13699,8 +13699,8 @@ so that propagation occurs.
|
|||
(let* ([blame-pos (contract-eval '(make-blame (srcloc #f #f #f #f #f) #f (λ () 'integer?) 'positive 'negative #t))]
|
||||
[blame-neg (contract-eval `(blame-swap ,blame-pos))])
|
||||
(ctest "something ~a" blame-fmt->-string ,blame-neg "something ~a")
|
||||
(ctest "promised: ~s\n produced: ~e" blame-fmt->-string ,blame-pos '(expected: "~s" given: "~e"))
|
||||
(ctest "expected: ~s\n given: ~e" blame-fmt->-string ,blame-neg '(expected: "~s" given: "~e"))
|
||||
(ctest "promised: ~s\n produced: ~e" blame-fmt->-string ,blame-pos '(expected: "~s" given: "~e"))
|
||||
(ctest "expected: ~s\n given: ~e" blame-fmt->-string ,blame-neg '(expected: "~s" given: "~e"))
|
||||
(ctest "promised ~s produced ~e" blame-fmt->-string ,blame-pos '(expected "~s" given "~e"))
|
||||
(ctest "expected ~s given ~e" blame-fmt->-string ,blame-neg '(expected "~s" given "~e")))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user