Fixed blame detection regexp.

svn: r17742

original commit: 35a716d5d36b4995c025d3e46089e3dea7a09dc8
This commit is contained in:
Carl Eastlund 2010-01-19 07:14:17 +00:00
parent ff9748dd99
commit d9e5df35ed

View File

@ -78,13 +78,9 @@ of the contract library does not change over time.
(define (test/spec-failed name expression blame)
(let ()
(define (has-proper-blame? msg)
(equal?
blame
(cond
[(regexp-match #rx"(^| )(.*) broke" msg)
=>
(λ (x) (caddr x))]
[else (format "no blame in error message: \"~a\"" msg)])))
(regexp-match?
(string-append "(^| )" (regexp-quote blame) " broke")
msg))
(printf "testing: ~s\n" name)
(contract-eval
`(,thunk-error-test
@ -5127,7 +5123,11 @@ so that propagation occurs.
(and (exn? x)
(regexp-match #rx"expected field name to be b, but found string?" (exn-message x)))))
(contract-eval `(,test 'pos guilty-party (with-handlers ((void values)) (contract not #t 'pos 'neg))))
(contract-eval
`(,test
'pos
(compose blame-guilty exn:fail:contract:blame-object)
(with-handlers ((void values)) (contract not #t 'pos 'neg))))
(report-errs)