You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For check-error-tests.rkt consisting of 5 check-error tests
; This is check-error-tests.rkt
#lang htdp/bsl
(check-error (* (5) 3)
"function call: expected a function after the open parenthesis, but found a number")
(check-error (+ (* 24))
"+: expects at least 2 arguments, but found only 1")
(check-error (5 * 14)
"function call: expected a function after the open parenthesis, but found a number")
(check-error (* + 352)
"+: expected a function call, but there is no open parenthesis before this function")
(check-error (/ 250)
"/: division by zero")
(The 5 erroneous expression are taken from A Functional Introduction To Computer Science (Part I) by Prabhakar Ragde, sec. 2.2, Exercise 0.)
Running it in DrRacket, "All 5 tests passed!".
But if executing raco test check-error-tests.rkt, the 1st, 3rd, and the 4th tests failed.
Full command-line output
$ raco test check-error-tests.rkt
raco test: (submod (file "check-error-tests.rkt") test)
Ran 5 tests.
3 of the 5 tests failed.
Check failures:
check-error encountered the following error instead of the expected function call: expected a function after the open parenthesis, but found a number
check-error-tests.rkt:3:17: function call: expected a function after the open parenthesis, but found a number
at: 5
in: (#%app 5)
location...:
check-error-tests.rkt:3:17
context...:
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:65:25
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/racket-tests.rkt:247:5
:: /Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:91:17
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:89:0: execute-test
/Applications/Racket v8.15/collects/racket/contract/private/arrow-higher-order.rkt:379:33
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/test-engine.rkt:182:14
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/test-engine.rkt:175:0: run-tests!
/Applications/Racket v8.15/collects/racket/contract/private/arrow-val-first.rkt:486:18
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:128:0: test*
body of (submod "/path/to/file/check-error-tests.rkt" test)
/Applications/Racket v8.15/share/pkgs/compiler-lib/compiler/commands/test.rkt:209:16
in check-error-tests.rkt, line 3, column 0
check-error encountered the following error instead of the expected function call: expected a function after the open parenthesis, but found a number
check-error-tests.rkt:9:14: function call: expected a function after the open parenthesis, but found a number
at: 5
in: (#%app 5 * 14)
location...:
check-error-tests.rkt:9:14
context...:
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:65:25
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/racket-tests.rkt:247:5
:: /Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:91:17
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:89:0: execute-test
/Applications/Racket v8.15/collects/racket/contract/private/arrow-higher-order.rkt:379:33
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/test-engine.rkt:182:14
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/test-engine.rkt:175:0: run-tests!
/Applications/Racket v8.15/collects/racket/contract/private/arrow-val-first.rkt:486:18
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:128:0: test*
body of (submod "/path/to/file/check-error-tests.rkt" test)
/Applications/Racket v8.15/share/pkgs/compiler-lib/compiler/commands/test.rkt:209:16
in check-error-tests.rkt, line 9, column 0
check-error encountered the following error instead of the expected +: expected a function call, but there is no open parenthesis before this function
check-error-tests.rkt:12:16: +: expected a function call, but there is no open parenthesis before this function
in: +
location...:
check-error-tests.rkt:12:16
context...:
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:65:25
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/racket-tests.rkt:247:5
:: /Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:91:17
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:89:0: execute-test
/Applications/Racket v8.15/collects/racket/contract/private/arrow-higher-order.rkt:379:33
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/test-engine.rkt:182:14
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/test-engine.rkt:175:0: run-tests!
/Applications/Racket v8.15/collects/racket/contract/private/arrow-val-first.rkt:486:18
/Applications/Racket v8.15/share/pkgs/htdp-lib/test-engine/syntax.rkt:128:0: test*
body of (submod "/path/to/file/check-error-tests.rkt" test)
/Applications/Racket v8.15/share/pkgs/compiler-lib/compiler/commands/test.rkt:209:16
in check-error-tests.rkt, line 12, column 0
The text was updated successfully, but these errors were encountered:
muzimuzhi
changed the title
Differences when running check-error test in DrRacket IDE vs raco test
Differences when running check-error tests in DrRacket IDE vs raco testFeb 10, 2025
Not sure whether it's related to DrRacket having a different error-display-handler.
Here is a minimal example. It works in DrRacket and fails from command line.
; This is stxerr.rkt
#lang htdp/bsl
(check-error define"define: expected an open parenthesis before define, but found none")
Here is an alternative example that FAILS in DrRacket and WORKS from the command line.
; This is stxerr.rkt
#lang htdp/bsl
(check-error define"stxerr.rkt:3:13: define: expected an open parenthesis before define, but found none\n in: define")
For
check-error-tests.rkt
consisting of 5check-error
tests(The 5 erroneous expression are taken from A Functional Introduction To Computer Science (Part I) by Prabhakar Ragde, sec. 2.2, Exercise 0.)
Running it in DrRacket, "All 5 tests passed!".
But if executing
raco test check-error-tests.rkt
, the 1st, 3rd, and the 4th tests failed.Full command-line output
The text was updated successfully, but these errors were encountered: