Skip to content

Commit

Permalink
Add one combined test for racket/htdp#230.
Browse files Browse the repository at this point in the history
  • Loading branch information
shhyou committed Oct 27, 2024
1 parent 1f725c9 commit 98d7134
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions drracket-test/tests/drracket/module-lang-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,57 @@ f: contract violation
(check-expect (* 2 3) 6)}
#rx"^Ran 1 test[.]\n0 tests passed[.].*Check failures:.*\nThe test passed!$")

(test @t{#lang htdp/isl
(check-expect (* 2 3) 6)
(check-expect (* 2 3) 5)
(check-expect (+ 2 3) 5)}
;; REPL
@t{(check-expect (+ 4 5) 9)
(check-expect (+ 6 7) 42)
(check-expect (* 8 9) 72)
(check-expect (error 'oops) 111)}
#px"^Ran 3 tests[.]\\s+1 of the 3 tests failed[.]"
#t
#:extra-assert
(λ (defs ints #:test test)
(define re
(pregexp
@t{^Ran 3 tests[.]
1 of the 3 tests failed[.]

Check failures:\s*
+Actual value 6 differs from 5, the expected value[.]\s*
at line 3, column 0
> @(regexp-quote (test-interactions test))
The test passed!
Ran 1 test[.]
0 tests passed[.]

Check failures:\s*
+Actual value 13 differs from 42, the expected value[.]\s*
at line 10, column 0
The test passed!
Ran 1 test[.]
0 tests passed[.]

Check failures:\s*
+check-expect encountered the following error instead of the expected value, 111[.]\s*
+:: +at line 12, column 14 oops:\s*
at line 12, column 0
> }))
;; Includes the flattened test result snips.
(define full-ints-text
(send ints get-text (send ints paragraph-start-position 2) 'eof #t))
(define passed?
(regexp-match? re full-ints-text))
(unless passed?
(eprintf "FAILED line ~a: ~a\n extra assertion expected: ~s\n\n got: ~a\n"
(test-line test)
(test-definitions test)
re
full-ints-text))
passed?))

(fire-up-drracket-and-run-tests run-test)

;; Test mode:
Expand Down

0 comments on commit 98d7134

Please sign in to comment.