Skip to content

Commit

Permalink
Play with borkdude/rewrite-edn
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorlu committed Jun 3, 2024
1 parent b98982b commit 4673253
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/babashka/neil/add_alias_test.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns babashka.neil.add-alias-test
(:require
[babashka.neil :as neil]
[borkdude.rewrite-edn :as r]
[clojure.string :as str]
[clojure.test :refer [deftest is]]))

Expand Down Expand Up @@ -60,3 +61,25 @@
println2)

)

(comment
;; how do I use rewrite-edn?

(str (r/assoc (r/parse-string "{:x 1\n :y 2}") :key "value"))

(let [s (str/triml "
{:deps {}
:aliases {}}
")]
(-> (r/parse-string s)
(r/assoc-in [:aliases :kaocha] {})
(r/assoc-in [:aliases :dev] {})
str
println))
;; =>
;; {:deps {}
;; :aliases {:kaocha {}
;; :dev {}}}

;; this works just perfectly.
)

0 comments on commit 4673253

Please sign in to comment.