aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDerek Passen <dpassen1@gmail.com>2025-01-22 00:24:27 -0600
committerGitHub <noreply@github.com>2025-01-21 22:24:27 -0800
commit049325e7734603e3c7ba05f26016beccafefb473 (patch)
treea1fe1e55a6a91e5678dfd2ededa2e6323016c76c /test
parent37f0a048bf91c7a145b33e98c984eb58132fb2f6 (diff)
Add support for `cljstyle` for Clojure code (#333)
Add support for [cljstyle](https://github.com/greglook/cljstyle) Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Diffstat (limited to 'test')
-rw-r--r--test/formatters/installers/cljstyle.bash1
-rw-r--r--test/formatters/samplecode/cljstyle/in.clj12
-rw-r--r--test/formatters/samplecode/cljstyle/in.cljs6
-rw-r--r--test/formatters/samplecode/cljstyle/in.edn4
-rw-r--r--test/formatters/samplecode/cljstyle/out.clj16
-rw-r--r--test/formatters/samplecode/cljstyle/out.cljs8
-rw-r--r--test/formatters/samplecode/cljstyle/out.edn2
7 files changed, 49 insertions, 0 deletions
diff --git a/test/formatters/installers/cljstyle.bash b/test/formatters/installers/cljstyle.bash
new file mode 100644
index 0000000..bffdfcf
--- /dev/null
+++ b/test/formatters/installers/cljstyle.bash
@@ -0,0 +1 @@
+curl -sLO "https://raw.githubusercontent.com/greglook/cljstyle/main/util/install-cljstyle" && chmod +x install-cljstyle && ./install-cljstyle
diff --git a/test/formatters/samplecode/cljstyle/in.clj b/test/formatters/samplecode/cljstyle/in.clj
new file mode 100644
index 0000000..c783b0f
--- /dev/null
+++ b/test/formatters/samplecode/cljstyle/in.clj
@@ -0,0 +1,12 @@
+(ns hello
+(:require [java-time.api :as t]))
+
+(defn time-str
+ "Returns a string representation of a datetime in the local time zone."
+ [instant]
+ (t/format
+ (t/with-zone (t/formatter "hh:mm a") (t/zone-id))
+instant))
+
+(defn run [opts]
+(println "Hello world, the time is" (time-str (t/instant))))
diff --git a/test/formatters/samplecode/cljstyle/in.cljs b/test/formatters/samplecode/cljstyle/in.cljs
new file mode 100644
index 0000000..1649480
--- /dev/null
+++ b/test/formatters/samplecode/cljstyle/in.cljs
@@ -0,0 +1,6 @@
+(ns hello-world.core
+(:require react-dom))
+
+(.render js/ReactDOM
+(.createElement js/React "h2" nil "Hello, React!")
+ (.getElementById js/document "app"))
diff --git a/test/formatters/samplecode/cljstyle/in.edn b/test/formatters/samplecode/cljstyle/in.edn
new file mode 100644
index 0000000..88af84a
--- /dev/null
+++ b/test/formatters/samplecode/cljstyle/in.edn
@@ -0,0 +1,4 @@
+{:deps {clojure.java-time/clojure.java-time
+{:mvn/version "1.1.0"}
+ }
+ }
diff --git a/test/formatters/samplecode/cljstyle/out.clj b/test/formatters/samplecode/cljstyle/out.clj
new file mode 100644
index 0000000..69c2dbb
--- /dev/null
+++ b/test/formatters/samplecode/cljstyle/out.clj
@@ -0,0 +1,16 @@
+(ns hello
+ (:require
+ [java-time.api :as t]))
+
+
+(defn time-str
+ "Returns a string representation of a datetime in the local time zone."
+ [instant]
+ (t/format
+ (t/with-zone (t/formatter "hh:mm a") (t/zone-id))
+ instant))
+
+
+(defn run
+ [opts]
+ (println "Hello world, the time is" (time-str (t/instant))))
diff --git a/test/formatters/samplecode/cljstyle/out.cljs b/test/formatters/samplecode/cljstyle/out.cljs
new file mode 100644
index 0000000..a2f1106
--- /dev/null
+++ b/test/formatters/samplecode/cljstyle/out.cljs
@@ -0,0 +1,8 @@
+(ns hello-world.core
+ (:require
+ [react-dom]))
+
+
+(.render js/ReactDOM
+ (.createElement js/React "h2" nil "Hello, React!")
+ (.getElementById js/document "app"))
diff --git a/test/formatters/samplecode/cljstyle/out.edn b/test/formatters/samplecode/cljstyle/out.edn
new file mode 100644
index 0000000..9c0ad45
--- /dev/null
+++ b/test/formatters/samplecode/cljstyle/out.edn
@@ -0,0 +1,2 @@
+{:deps {clojure.java-time/clojure.java-time
+ {:mvn/version "1.1.0"}}}