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

flatten only top level to avoid breaking values that are collections #479

Merged
merged 1 commit into from
Jul 29, 2016
Merged

Conversation

loomis
Copy link
Contributor

@loomis loomis commented Jul 10, 2016

The function map-as-dep flattens values that are collections (like :exclusions), creating an invalid specification. The following shows this behavior:

(set-env!
 :dependencies '[[org.clojure/clojure "1.8.0"]])

(require '[clojure.test :refer [is]])

(def dep-map {:project 'myproject
              :version "1.0.0"
              :exclusions '[excl1 excl2]})

(def dep '[myproject "1.0.0" :exclusions [excl1 excl2]])

(is (= dep (boot.util/map-as-dep dep-map)))

which results in the output:

FAIL in () (boot.user4426527561266792223.clj:23)
expected: (= dep (boot.util/map-as-dep dep-map))
  actual: (not (= [myproject "1.0.0" :exclusions [excl1 excl2]] [myproject "1.0.0" :exclusions excl1 excl2]))

This PR flattens only the top-level, preserving the values that are collections.

Let me know if there's a place to add unit tests. If so, I can add a test of this behavior.

@micha micha added the Bug label Jul 29, 2016
@micha micha added this to the 2.6.1 milestone Jul 29, 2016
@micha
Copy link
Contributor

micha commented Jul 29, 2016

Looks great, thanks! There are tests in boot/pod/test/ (relative to repo root) if you would like to add a unit test 👍

@micha micha merged commit d66a065 into boot-clj:master Jul 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants