File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
main/clojure/clojure/tools/deps/cli
test/clojure/clojure/tools/deps/cli Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 392
392
[{:keys [lib tool n] :or {n 8 } :as args}]
393
393
(let [{:keys [root-edn user-edn]} (deps/find-edn-maps )
394
394
master-edn (deps/merge-edns [root-edn user-edn])
395
- trunc-fn (if (= n :all ) (fn [_n x] x) #(apply take-last %&))
395
+ trunc-fn (fn [n x]
396
+ (if (= n :all )
397
+ x
398
+ (mapcat #(take-last n %) (vals (group-by keys x)))))
396
399
coords (cond
397
400
tool
398
401
(if-let [{:keys [lib coord]} (tool/resolve-tool (name tool))]
Original file line number Diff line number Diff line change 1
1
(ns clojure.tools.deps.cli.test-api
2
2
(:require
3
+ [clojure.edn :as edn]
3
4
[clojure.java.io :as jio]
4
5
[clojure.string :as str]
5
6
[clojure.test :refer [deftest is] :as test]
196
197
197
198
(is (= " " (with-out-str (api/find-versions {:lib 'io.github.clojure/bogus-taco-slurpee})))))
198
199
200
+ (deftest test-find-versions-returns-results-from-all-procurers
201
+ (let [expected [[:git/tag :git/sha ] [:mvn/version ]]
202
+ actual (->> (api/find-versions {:lib 'io.github.clojure/tools.build :n 4 })
203
+ with-out-str
204
+ str/split-lines
205
+ (map edn/read-string)
206
+ (group-by keys)
207
+ keys)]
208
+ (is (= expected actual))))
209
+
199
210
(comment
200
211
(test-find-maven-version )
201
212
(test-find-git-version )
You can’t perform that action at this time.
0 commit comments