aboutsummaryrefslogtreecommitdiff
path: root/test/formatters/samplecode
diff options
context:
space:
mode:
authordalu <25452934+dalugm@users.noreply.github.com>2023-12-15 10:03:18 +0800
committerGitHub <noreply@github.com>2023-12-14 18:03:18 -0800
commita38279566a82c39253973e49a2a56634ded50212 (patch)
treeb13e1a0067868013d82b85a23cad4779e1e26109 /test/formatters/samplecode
parentefb9992c00e63b72f0474b19440be4666e95ebd1 (diff)
Add support for `cljfmt` (#271)
Diffstat (limited to 'test/formatters/samplecode')
-rw-r--r--test/formatters/samplecode/cljfmt/in.clj12
-rw-r--r--test/formatters/samplecode/cljfmt/in.cljs6
-rw-r--r--test/formatters/samplecode/cljfmt/in.edn4
-rw-r--r--test/formatters/samplecode/cljfmt/out.clj12
-rw-r--r--test/formatters/samplecode/cljfmt/out.cljs6
-rw-r--r--test/formatters/samplecode/cljfmt/out.edn2
6 files changed, 42 insertions, 0 deletions
diff --git a/test/formatters/samplecode/cljfmt/in.clj b/test/formatters/samplecode/cljfmt/in.clj
new file mode 100644
index 0000000..c783b0f
--- /dev/null
+++ b/test/formatters/samplecode/cljfmt/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/cljfmt/in.cljs b/test/formatters/samplecode/cljfmt/in.cljs
new file mode 100644
index 0000000..1649480
--- /dev/null
+++ b/test/formatters/samplecode/cljfmt/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/cljfmt/in.edn b/test/formatters/samplecode/cljfmt/in.edn
new file mode 100644
index 0000000..88af84a
--- /dev/null
+++ b/test/formatters/samplecode/cljfmt/in.edn
@@ -0,0 +1,4 @@
+{:deps {clojure.java-time/clojure.java-time
+{:mvn/version "1.1.0"}
+ }
+ }
diff --git a/test/formatters/samplecode/cljfmt/out.clj b/test/formatters/samplecode/cljfmt/out.clj
new file mode 100644
index 0000000..6738667
--- /dev/null
+++ b/test/formatters/samplecode/cljfmt/out.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/cljfmt/out.cljs b/test/formatters/samplecode/cljfmt/out.cljs
new file mode 100644
index 0000000..e985c42
--- /dev/null
+++ b/test/formatters/samplecode/cljfmt/out.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/cljfmt/out.edn b/test/formatters/samplecode/cljfmt/out.edn
new file mode 100644
index 0000000..9c0ad45
--- /dev/null
+++ b/test/formatters/samplecode/cljfmt/out.edn
@@ -0,0 +1,2 @@
+{:deps {clojure.java-time/clojure.java-time
+ {:mvn/version "1.1.0"}}}