Skip to content

Commit

Permalink
Adjust a test case for a new expected result and add a test case matc…
Browse files Browse the repository at this point in the history
…hing the buggy program in racket/htdp#212

related to racket/htdp#213
  • Loading branch information
rfindler committed Dec 21, 2023
1 parent d04b759 commit 2166917
Showing 1 changed file with 81 additions and 6 deletions.
87 changes: 81 additions & 6 deletions drracket-test/tests/drracket/language-test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -511,17 +511,20 @@ the settings above should match r5rs
"Both tests passed!")
(test-expression "(check-expect 1 1)\n(check-expect 2 2)\n(+ \"hello\" \"world\")\n(check-expect 3 3)\n"
(λ (got)
(define m (regexp-match #rx"(.*)Both tests passed(.*)" got))
(define m (regexp-match #rx"(.*)0 tests passed(.*)" got))
(cond
[m
(define before (list-ref m 1))
(define after (list-ref m 2))
(and (not (regexp-match? #rx"Both tests passed" before))
(not (regexp-match? #rx"Both tests passed" after)))]
(and (not (regexp-match? #rx"tests? passed" before))
(not (regexp-match? #rx"tests? passed" after)))]
[else #f]))
(λ (got) #t)) ;; just skip the interactions test
(test-expression "(define (badfn x) (error \"hello\"))\n(check-expect (badfn 1) 1)\n(error \"hello\")"
#rx"0 tests passed[.].*hello"
(λ (got) #t))

(test-undefined-fn "(time 1)" "time"))
(test-undefined-fn "(time 1)" "time")

(test-expression "true"
"#true"
Expand Down Expand Up @@ -621,7 +624,7 @@ the settings above should match r5rs

(test-expression "(require racket/gui/base)(require racket/class)(make-object bitmap% 1 1)"
"{image}"
"{image}"))
"{image}")))

(define (bsl)
(parameterize ([language '(module "htdp/bsl")]
Expand Down Expand Up @@ -895,7 +898,25 @@ the settings above should match r5rs
(test-expression "(error 'a \"~a\" 1)" "a: ~a1")
(test-expression "(error \"a\" \"a\")" "aa")

(test-undefined-fn "(time 1)" "time")
(test-expression "(check-expect 1 1)"
"The test passed!"
"Both tests passed!")
(test-expression "(check-expect 1 1)\n(check-expect 2 2)\n(+ \"hello\" \"world\")\n(check-expect 3 3)\n"
(λ (got)
(define m (regexp-match #rx"(.*)0 tests passed(.*)" got))
(cond
[m
(define before (list-ref m 1))
(define after (list-ref m 2))
(and (not (regexp-match? #rx"tests? passed" before))
(not (regexp-match? #rx"tests? passed" after)))]
[else #f]))
(λ (got) #t)) ;; just skip the interactions test
(test-expression "(define (badfn x) (error \"hello\"))\n(check-expect (badfn 1) 1)\n(error \"hello\")"
#rx"0 tests passed[.].*hello"
(λ (got) #t))

(test-undefined-fn "(time 1)" "time")

(test-expression "true"
"#true"
Expand Down Expand Up @@ -1053,6 +1074,24 @@ the settings above should match r5rs

(test-expression "(error 'a \"~a\" 1)" "a: ~a1")
(test-expression "(error \"a\" \"a\")" "aa")

(test-expression "(check-expect 1 1)"
"The test passed!"
"Both tests passed!")
(test-expression "(check-expect 1 1)\n(check-expect 2 2)\n(+ \"hello\" \"world\")\n(check-expect 3 3)\n"
(λ (got)
(define m (regexp-match #rx"(.*)0 tests passed(.*)" got))
(cond
[m
(define before (list-ref m 1))
(define after (list-ref m 2))
(and (not (regexp-match? #rx"tests? passed" before))
(not (regexp-match? #rx"tests? passed" after)))]
[else #f]))
(λ (got) #t)) ;; just skip the interactions test
(test-expression "(define (badfn x) (error \"hello\"))\n(check-expect (badfn 1) 1)\n(error \"hello\")"
#rx"0 tests passed[.].*hello"
(λ (got) #t))

(test-expression "(time 1)"
#rx"cpu time: [0-9]+ real time: [0-9]+ gc time: [0-9]+\n1")
Expand Down Expand Up @@ -1208,6 +1247,24 @@ the settings above should match r5rs
(test-expression "(error 'a \"~a\" 1)" "a: ~a1")
(test-expression "(error \"a\" \"a\")" "aa")

(test-expression "(check-expect 1 1)"
"The test passed!"
"Both tests passed!")
(test-expression "(check-expect 1 1)\n(check-expect 2 2)\n(+ \"hello\" \"world\")\n(check-expect 3 3)\n"
(λ (got)
(define m (regexp-match #rx"(.*)0 tests passed(.*)" got))
(cond
[m
(define before (list-ref m 1))
(define after (list-ref m 2))
(and (not (regexp-match? #rx"tests? passed" before))
(not (regexp-match? #rx"tests? passed" after)))]
[else #f]))
(λ (got) #t)) ;; just skip the interactions test
(test-expression "(define (badfn x) (error \"hello\"))\n(check-expect (badfn 1) 1)\n(error \"hello\")"
#rx"0 tests passed[.].*hello"
(λ (got) #t))

(test-expression "(time 1)"
#rx"cpu time: [0-9]+ real time: [0-9]+ gc time: [0-9]+\n1")

Expand Down Expand Up @@ -1359,6 +1416,24 @@ the settings above should match r5rs
(test-expression "(error 'a \"~a\" 1)" "a: ~a1")
(test-expression "(error \"a\" \"a\")" "aa")

(test-expression "(check-expect 1 1)"
"The test passed!"
"Both tests passed!")
(test-expression "(check-expect 1 1)\n(check-expect 2 2)\n(+ \"hello\" \"world\")\n(check-expect 3 3)\n"
(λ (got)
(define m (regexp-match #rx"(.*)0 tests passed(.*)" got))
(cond
[m
(define before (list-ref m 1))
(define after (list-ref m 2))
(and (not (regexp-match? #rx"tests? passed" before))
(not (regexp-match? #rx"tests? passed" after)))]
[else #f]))
(λ (got) #t)) ;; just skip the interactions test
(test-expression "(define (badfn x) (error \"hello\"))\n(check-expect (badfn 1) 1)\n(error \"hello\")"
#rx"0 tests passed[.].*hello"
(λ (got) #t))

(test-expression "(time 1)"
#rx"cpu time: [0-9]+ real time: [0-9]+ gc time: [0-9]+\n1")

Expand Down

0 comments on commit 2166917

Please sign in to comment.