Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assoc-in does not add expected newlines #36

Closed
teodorlu opened this issue Sep 24, 2023 · 0 comments
Closed

assoc-in does not add expected newlines #36

teodorlu opened this issue Sep 24, 2023 · 0 comments

Comments

@teodorlu
Copy link

Following up on babashka/neil#169.

I get the behavior I expect when the assoc-in path has only one element:

(let [deps-str "
{:deps
 {hiccup {:mvn/version \"1.0.4\"}}}
"]
  (= "
{:deps
 {hiccup {:mvn/version \"1.0.4\"}}
 :aliases {}}
"
     (-> deps-str
         r/parse-string
         (r/assoc-in [:aliases] {})
         str)))
;; => true

I do not get the behavior I expect when the assoc-in path has two elements.

Expected:

(let [deps-str "
{:deps
 {hiccup {:mvn/version \"1.0.4\"}}}
"]
  (= "
{:deps
 {hiccup {:mvn/version \"1.0.4\"}}
 :aliases {:neil {}}}
"
     (-> deps-str
         r/parse-string
         (r/assoc-in [:aliases :neil] {})
         str)))

Actual:

(let [deps-str "
{:deps
 {hiccup {:mvn/version \"1.0.4\"}}}
"]
  (= "
{:deps
 {hiccup {:mvn/version \"1.0.4\"}} :aliases {:neil {}}}
"
     (-> deps-str
         r/parse-string
         (r/assoc-in [:aliases :neil] {})
         str)))
;; => true

In other words, :aliases {:neil {}} shows up on the same line as hiccup, when I'd like to see it printed on its own line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant