Closed thheller closed 2 years ago
Thanks! Can you add a capital letter to the start of the commit message?
Sure, done.
Thanks! Just one more thing: I notice there aren't any tests for this. Could you add a couple, one for testing when
and the other for testing let
?
Sure, but looking through the existing tests I have no idea how to go about that. The compiled form produces the exact same output as the uncompiled form, thus just testing the output is not actually a reliable test that the code worked.
Inspecting the macroexpand
output seems too restrictive given that one might want to change things in the future which may yield different code.
So just a "test" that compares the output and disregards the possibility that something wasn't compiled just interpreted? Any other ideas?
I should have been a little clearer. I don't think we need a test to check that it's being precompiled, because as you say that's pretty complex! But I think we can have a test to check that the wrong output isn't produced. So something like:
(is (= (html (let [x "foo"] [:span x])) "<span>foo</span>")
Similarly one for when
.
Currently only
if
andfor
are pre-compiled byhiccup.compiler
. Addedlet
andwhen
since those are the most common I have as well and they fall back to interpreted mode.Might be useful to add
cond
,case
,condp
?