-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from brandoncorrea/clr
Add Support for ClojureCLR
- Loading branch information
Showing
71 changed files
with
1,908 additions
and
919 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,14 @@ jobs: | |
java-version: 21 | ||
distribution: 'temurin' | ||
|
||
- name: Prepare dotnet | ||
uses: xt0rted/[email protected] | ||
|
||
- name: Prepare Clojure CLR | ||
run: | | ||
dotnet tool install --global Clojure.Main --version 1.12.0-alpha10 | ||
dotnet tool install --global Clojure.Cljr --version 0.1.0-alpha5 | ||
- name: Cache Clojure Dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
|
@@ -36,8 +44,11 @@ jobs: | |
- name: Install NPM Dependencies | ||
run: npm install | ||
|
||
- name: Run Clojure Tests | ||
- name: Run Clojure JVM Tests | ||
run: clojure -M:test:spec | ||
|
||
- name: Run Clojure CLR Tests | ||
run: cljr -M:test:spec | ||
|
||
- name: Run ClojureScript Tests | ||
run: clojure -M:test:cljs ci |
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 |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
.cpcache | ||
.DS_Store | ||
.idea | ||
.lein* | ||
.clj-kondo | ||
.lsp | ||
.specljs-timestamp | ||
doc | ||
node_modules | ||
|
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
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,4 @@ | ||
{:paths ["src/clj" "src/cljc" "src/cljr"] | ||
:deps {io.github.clojure/clr.tools.namespace {:git/tag "v1.5.4" :git/sha "46d81cb"}} | ||
:aliases {:test {:extra-paths ["spec/clj" "spec/cljc" "spec/cljr"]} | ||
:spec {:main-opts ["-m" "speclj.main" "-c"]}}} |
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
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
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,9 @@ | ||
(ns speclj.event-spec | ||
(:require [speclj.core :refer :all] | ||
[speclj.event :as sut])) | ||
|
||
(describe "Event" | ||
|
||
(it "new-line" | ||
(should= 10 sut/new-line)) | ||
) |
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,49 @@ | ||
(ns speclj.freshener-spec | ||
(:require | ||
[clojure.tools.namespace.dir :as dir] | ||
[clojure.tools.namespace.repl :as repl] | ||
[speclj.core :refer :all] | ||
[speclj.freshener :refer :all] | ||
[speclj.io :as io] | ||
[speclj.platform :as platform])) | ||
|
||
(def sample-dir (io/canonical-file (io/as-file "examples/sample"))) | ||
|
||
(defn write-file [dir name content] | ||
(let [file (io/as-file dir name)] | ||
(io/make-parents file) | ||
(io/copy (io/make-input-stream (platform/get-bytes content) {}) file) | ||
file)) | ||
|
||
(describe "Freshener" | ||
|
||
(it "finds specified files by default" | ||
(write-file sample-dir "portable.cljx" "I'm antiquated") | ||
(let [files (find-files-in #".*\.cljx" sample-dir)] | ||
(should-contain "portable.cljx" (set (map io/file-name files))))) | ||
|
||
(it "first freshening adds files to listing" | ||
(write-file sample-dir "a.clj" "I'm a clojure file") | ||
(write-file sample-dir "b.cljc" "I'm a clojure common file") | ||
(write-file sample-dir "c.cljx" "I'm neither") | ||
(let [files (clj-files-in sample-dir)] | ||
(should-contain "a.clj" (set (map io/file-name files))) | ||
(should-contain "b.cljc" (set (map io/file-name files))) | ||
(should-not-contain "c.cljx" (set (map io/file-name files))))) | ||
|
||
(context "freshen" | ||
(before | ||
(repl/set-refresh-dirs sample-dir)) | ||
|
||
(it "new files are detected and added to tracker" | ||
(repl/clear) | ||
(freshen) | ||
(should= 2 (count (::dir/files repl/refresh-tracker))) | ||
(should-contain "a.clj" (set (map io/file-name (::dir/files repl/refresh-tracker)))) | ||
(should-contain "b.cljc" (set (map io/file-name (::dir/files repl/refresh-tracker))))) | ||
|
||
(it "refresh dirs are updated to nil indicating the classpath" | ||
(freshen) | ||
(should= nil repl/refresh-dirs))) | ||
|
||
(repl/clear)) |
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 speclj.interval-spec | ||
(:require [speclj.core :refer :all] | ||
[speclj.interval :as sut] | ||
[speclj.platform :as platform] | ||
[speclj.stub :as stub] | ||
[speclj.thread :as thread])) | ||
|
||
(describe "Interval" | ||
(with-stubs) | ||
|
||
(it "set-interval loops over handler" | ||
(let [key (sut/set-interval 50 (stub :interval))] | ||
(thread/sleep 100) | ||
(sut/clear-interval key) | ||
(let [invocations (count (stub/invocations-of :interval))] | ||
(should<= 2 invocations) | ||
(should>= 3 invocations)))) | ||
|
||
(it "unassigned" | ||
(should-not-throw (sut/clear-interval "blah"))) | ||
|
||
(it "does not sleep for the interval when cleared" | ||
(let [key (sut/set-interval 1000 #(thread/sleep 100)) | ||
start (platform/current-time)] | ||
(thread/sleep 50) | ||
(sut/clear-interval key) | ||
(should= 0.1 (platform/secs-since start) 0.01))) | ||
|
||
) |
Oops, something went wrong.