Skip to content

Commit

Permalink
fix electric test shim
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurC committed Jan 31, 2024
1 parent 6021909 commit 5842ea8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/hyperfiddle/electric_local_def_de.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
#?(:clj (defn run-single [frame] (m/reduce #(do %2) nil frame)))
#?(:clj (defmacro single {:style/indent 0} [conf & body]
(ca/check map? conf)
(let [env (merge (->local-config (lang/normalize-env &env)) conf)]
(let [env (merge (->local-config &env) (lang/normalize-env &env) conf)]
`(run-single (r/root-frame {::Main ~(lang/compile ::Main `(do ~@body) env)} ::Main)))))
11 changes: 2 additions & 9 deletions test/hyperfiddle/electric_de_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
(:require [hyperfiddle.rcf :as rcf :refer [tests tap with %]]
[hyperfiddle.electric-local-def-de :as l]))

;; fails to compile, rcf rewrites `tap` to `RCF__tap` and electric compiler fails to resolve that
;; (tests "hello world"
;; (with ((l/single {} (tap "hello world")) tap tap)
;; % := "hello world"))

(def hello (l/single {} (tap "hello world")))
(tests "hello world"
(with (hello tap tap)
% := "hello world" ; returns a diff {:degree 1, :permutation {}, :grow 1, :shrink 0, :change {0 "hello world"}, :freeze #{0}}
))
(with ((l/single {} (tap "hello world")) tap tap)
% := "hello world"))

0 comments on commit 5842ea8

Please sign in to comment.