Skip to content

Commit

Permalink
fixed tests for reflective attrs, added test for reflective alias
Browse files Browse the repository at this point in the history
  • Loading branch information
onionpancakes committed Feb 19, 2024
1 parent 6247fe1 commit 0588206
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/dev/onionpancakes/chassis/tests/test_compiler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,19 @@
(when (identical? (::cc/warn m) :ambig-attrs)
(swap! ambig-attrs-count inc))))

(try
(add-tap count-ambig-attrs)
(add-tap count-ambig-attrs)

(do
;; Compile attrs reflection examples
(let [attrs nil]
(cc/compile [:div ^java.util.Map attrs "foobar"]))
(let [^java.util.Map attrs nil]
(cc/compile [:div attrs "foobar"]))
(finally
(remove-tap count-ambig-attrs)))
(defmethod c/resolve-alias ::ReflectiveAttrsAlias
[_ _ ^java.util.Map attrs content]
(cc/compile [:div.reflective-alias-attrs attrs content])))

(remove-tap count-ambig-attrs)

(deftest test-compile-attrs-reflection
(is (zero? @ambig-attrs-count)))

0 comments on commit 0588206

Please sign in to comment.