|
2 | 2 |
|
3 | 3 | (require (only-in lang/private/teach check-property
|
4 | 4 | for-all Integer)
|
| 5 | + (only-in lang/htdp-beginner |
| 6 | + [#%app #%app/bsl] |
| 7 | + empty) |
5 | 8 | (only-in lang/htdp-intermediate-lambda
|
6 | 9 | [define define/isl]
|
| 10 | + [#%app #%app/isl] |
7 | 11 | local)
|
8 | 12 | (only-in htdp/bsl/runtime configure)
|
9 | 13 | (except-in rackunit check-within)
|
|
254 | 258 | incorrect-error-expected "another message"
|
255 | 259 | incorrect-error-exn exn:fail:contract?)
|
256 | 260 |
|
| 261 | +(check-error (empty) "function call: expected a function after the open parenthesis, but received '()") |
| 262 | +(check-success) |
| 263 | + |
| 264 | +;; rational: x is unbound so this check-error shall not pass |
| 265 | +;; (but it also should not raise the syntax error immediately at expansion) |
| 266 | +(check-error x "x: this variable is not defined") |
| 267 | +(check-failure unexpected-error? |
| 268 | + unexpected-error-exn exn:fail:syntax? |
| 269 | + unexpected-error-expected "x: this variable is not defined" |
| 270 | + unexpected-error/markup-error-markup |
| 271 | + (lambda (m) |
| 272 | + (regexp-match? |
| 273 | + ;; From the command line, tests/test-engine/racket-tests[.]rkt is |
| 274 | + ;; in the error message |
| 275 | + ;; |
| 276 | + ;; Ideally, we want to see the message "x: this variable is not defined" in |
| 277 | + ;; the exception. Unfortunately, the #%top binding is not from *sl. |
| 278 | + #rx"x: unbound identifier.*tests/test-engine/racket-tests[.]rkt" |
| 279 | + (with-output-to-string |
| 280 | + (lambda () (display-markup m)))))) |
| 281 | + |
| 282 | +(check-error (#%app/isl 123) "function call: expected a function after the open parenthesis, but received 123") |
| 283 | +(check-success) |
| 284 | + |
| 285 | +(check-error (#%app/bsl 123) "function call: expected a function after the open parenthesis, but found a number") |
| 286 | +(check-failure unexpected-error? |
| 287 | + unexpected-error-exn exn:fail:syntax? |
| 288 | + unexpected-error-expected "function call: expected a function after the open parenthesis, but found a number" |
| 289 | + unexpected-error/markup-error-markup |
| 290 | + (lambda (m) |
| 291 | + (regexp-match? |
| 292 | + ;; From the command line, tests/test-engine/racket-tests[.]rkt is |
| 293 | + ;; in the error message |
| 294 | + #rx"function call: expected a function after the open parenthesis, but found a number.*tests/test-engine/racket-tests[.]rkt" |
| 295 | + (with-output-to-string |
| 296 | + (lambda () (display-markup m)))))) |
| 297 | + |
| 298 | +(check-error define/isl "define: expected an open parenthesis before define, but found none") |
| 299 | +(check-failure unexpected-error? |
| 300 | + unexpected-error-exn exn:fail:syntax? |
| 301 | + unexpected-error-expected "define: expected an open parenthesis before define, but found none" |
| 302 | + unexpected-error/markup-error-markup |
| 303 | + (lambda (m) |
| 304 | + (regexp-match? |
| 305 | + ;; From the command line, tests/test-engine/racket-tests[.]rkt is |
| 306 | + ;; in the error message |
| 307 | + #rx"define: expected an open parenthesis before define, but found none.*tests/test-engine/racket-tests[.]rkt" |
| 308 | + (with-output-to-string |
| 309 | + (lambda () (display-markup m)))))) |
| 310 | + |
257 | 311 | (define (create n)
|
258 | 312 | (make-ball n n 'blue))
|
259 | 313 |
|
|
0 commit comments