This repository has been archived by the owner on Apr 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated intern source reader to support cljx
- Loading branch information
Showing
4 changed files
with
96 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(ns rksm.cloxp-source-reader.cljx-test | ||
(:require [clojure.test :refer :all] | ||
[rksm.cloxp-source-reader.core :as src-rdr] | ||
[rksm.system-files.cljx :as cljx])) | ||
|
||
(defn fixture [test] | ||
(cljx/enable-cljx-load-support!) | ||
(test) | ||
(remove-ns 'rksm.cloxp-source-reader.test.cljx-dummy)) | ||
|
||
(use-fixtures :each fixture) | ||
|
||
(deftest read-cljx-intern-source | ||
(require 'rksm.cloxp-source-reader.test.cljx-dummy :reload) | ||
(let [meta-data (src-rdr/add-source-to-interns | ||
'rksm.cloxp-source-reader.test.cljx-dummy | ||
(map meta (vals (ns-interns 'rksm.cloxp-source-reader.test.cljx-dummy)))) | ||
sources (map :source meta-data) | ||
expected '("(defn x-to-string\n [x]\n (let [buf #+clj (StringBuilder.) #+cljs (gstring/StringBuffer.)]\n (.append buf \"x is: \")\n (.append buf (str x))))\n" | ||
"(def x 23)\n" | ||
"(def y #+clj 24 #+cljx 25)")] | ||
(is (= expected sources)))) | ||
|
||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | ||
|
||
(comment | ||
(keep (comp (partial re-find #".*repl.*") str) (rksm.system-files/classpath)) | ||
(run-tests *ns*) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
(ns rksm.cloxp-source-reader.test.cljx-dummy) | ||
|
||
(defn x-to-string | ||
[x] | ||
(let [buf #+clj (StringBuilder.) #+cljs (gstring/StringBuffer.)] | ||
(.append buf "x is: ") | ||
(.append buf (str x)))) | ||
|
||
(reify | ||
#+clj clojure.lang.IFn | ||
#+cljs cljs.core.IFn | ||
(invoke [_ x] (inc x))) | ||
|
||
(def x 23) | ||
|
||
(def y #+clj 24 #+cljx 25) |