Skip to content

Commit dec519a

Browse files
committed
Added tests that expose problem in test-judgment-holds
When a test-judgment-holds test fails for a modeless judgment, the error message will incorrectly blame any sub-derivation that is not from the same judgment as the top-level judgment.
1 parent 740b3db commit dec519a

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

redex-test/redex/tests/tl-test.rkt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,69 @@
226226
(test (capture-output (test-results))
227227
"3 tests failed (out of 4 total).\n"))
228228

229+
(let ()
230+
(define-judgment-form empty-language
231+
[----------- "Base"
232+
(J1 natural 1)])
233+
234+
(define-judgment-form empty-language
235+
[----------- "Base"
236+
(J2 natural 1)]
237+
238+
[(J1 any_1 any_2)
239+
(J2 any_1 any_3)
240+
-------------- "Pair"
241+
(J2 (any_1 any_2) any_3)])
242+
243+
(test
244+
(capture-output
245+
(test-judgment-holds J2 (derivation `(J2 (1 x) 1) "Pair"
246+
(list
247+
(derivation `(J1 1 x) "Base"
248+
(list))
249+
(derivation `(J2 1 1) "Base"
250+
(list))))))
251+
(regexp
252+
(regexp-quote "because the following sub-derivations fail:
253+
(derivation '(J1 1 x) \"Base\" '())
254+
(derivation
255+
'(J2 (1 x) 1)
256+
\"Pair\"
257+
(list
258+
(derivation '(J1 1 x) \"Base\" '())
259+
(derivation '(J2 1 1) \"Base\" '())))")))
260+
261+
(test
262+
(capture-output
263+
(test-judgment-holds J2 (derivation `(J2 (1 1) 2) "Pair"
264+
(list
265+
(derivation `(J1 1 1) "Base"
266+
(list))
267+
(derivation `(J2 1 2) "Base"
268+
(list))))))
269+
(regexp
270+
(regexp-quote "because the following sub-derivations fail:
271+
(derivation '(J2 1 2) \"Base\" '())
272+
(derivation
273+
'(J2 (1 1) 2)
274+
\"Pair\"
275+
(list
276+
(derivation '(J1 1 1) \"Base\" '())
277+
(derivation '(J2 1 2) \"Base\" '())))")))
278+
279+
(test
280+
(capture-output
281+
(test-judgment-holds J2 (derivation `(J2 (2 1) 1) "Pair"
282+
(list
283+
(derivation `(J1 2 1) "Base"
284+
(list))
285+
(derivation `(J2 2 1) "Base"
286+
(list))))))
287+
"")
288+
289+
(test (capture-output (test-results))
290+
"2 tests failed (out of 3 total).\n"))
291+
229292
(let ()
230293
(define-judgment-form empty-language
231294
#:mode (broken-swap I I O O)

0 commit comments

Comments
 (0)