I got all tests to pass by updating the first clause of pre-escape to use equal?

> (and (txexpr? x) (equal? "text" (attr-ref x 'type #f)))

My hypothesis is that when you didn't have bytecode, the reference to the 
literal string "text" just happened to be eq?. I couldn't say why.

On 10/24/21 12:09 PM, 'Joel Dueck' via Racket Users wrote:

> 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]))
>
> [1]: 
> https://pkg-build.racket-lang.org/server/built/test-fail/splitflap-lib.txt
> [2]: 
> https://github.com/otherjoel/splitflap/blob/11ddfebb96d13b4905d428939ba3bd9bd39e1caa/splitflap-lib/private/dust.rkt#L101-L102
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> [https://groups.google.com/d/msgid/racket-users/10b7621b-c366-4c78-ac86-f011d46a954fn%40googlegroups.com](https://groups.google.com/d/msgid/racket-users/10b7621b-c366-4c78-ac86-f011d46a954fn%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/85aa1a42-48a1-1129-269a-be282acd6cc3%40sagegerard.com.

Reply via email to