This is driving me a little batty. I have a package on the package server, and the package server shows that it is failing some tests[1].
Here is the first test that fails:
FAILURE
name: check-equal?
location: dust.rkt:101:2
actual:
'(div (div ((type "text"))
"Judy's friend \"George\""
(div "Judy's friend \"George\"")))
expected:
'(div (div ((type "text"))
"Judy%amp%apos;s friend %amp%quot;George%amp%quot;"
(div "Judy's friend \"George\"")))
The check in question can be seen in dust.rkt on the Github repo [2].
Here’s the weird part. This check does not fail on my local machine (Racket 8.2 CS on Mac OS 11.6). Well…not true! It *usually* doesn’t fail on my computer BUT sometimes checks in my tests.rkt which are dependent on this one will start failing. When that happens, all I need to do is re-save dust.rkt with no changes (to invalidate the compile cache) and re-run tests.rkt and the checks all pass again.
Of what known gotcha have I run afoul here? Or is it an unknown gotcha?
The function which is the subject of the test is not complicated:
;; Recursively pre-escape any string entities in an x-expression that
;; are direct children of an element whose ‘type’ attribute is “text”
(define (pre-escape x)
(cond
[(and (txexpr? x) (eq? "text" (attr-ref x 'type #f)))
(txexpr
(car x)
(get-attrs x)
(map (λ (c) (if (string? c) (pre-escape-entities c) (pre-escape c))) (get-elements x)))]
[(txexpr? x) (txexpr (car x) (get-attrs x) (map pre-escape (get-elements x)))]
[else x]))