-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
install-latest works when providing git :coord without :sha
- Loading branch information
1 parent
4d43641
commit 9f09a64
Showing
5 changed files
with
103 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Clojure Tests | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Install rlwrap | ||
run: sudo apt-get install -y rlwrap | ||
|
||
- name: Install Clojure Tools | ||
uses: DeLaGuardo/setup-clojure@13.0 | ||
with: | ||
cli: latest | ||
|
||
- name: Run tests | ||
run: clj -X:test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
(ns clojure.tools.tools.api-test | ||
(:require | ||
[clojure.string :as str] | ||
[clojure.test :refer :all] | ||
[clojure.tools.tools.api :as sut])) | ||
|
||
(def tool-install-name "temporary-ci-test-tool") | ||
|
||
(deftest install-update-list-and-remove | ||
(testing "Install specific version that is not the latest" | ||
(let [expected-response (str tool-install-name ": Installed com.github.seancorfield/deps-new v0.4.9") | ||
actual-response (with-out-str (sut/install {'com.github.seancorfield/deps-new {:git/url "https://github.com/seancorfield/deps-new" | ||
:git/tag "v0.4.9"} :as tool-install-name}))] | ||
(is (str/includes? actual-response expected-response)))) | ||
|
||
(testing "list installed tools" | ||
(let [expected-response (re-pattern (str tool-install-name "\\s*com\\.github\\.seancorfield/deps-new\\s*:git\\s*v0\\.4\\.9")) | ||
actual-response (with-out-str (sut/list nil))] | ||
(is (re-find expected-response actual-response)))) | ||
|
||
(testing "update installed tool to latest version" | ||
;; Would be more desirable if we had a test tool to install and could check the specific version that wouldn't change | ||
(let [expected-response (re-pattern (str tool-install-name ": Installed com\\.github\\.seancorfield/deps-new")) | ||
actual-response (with-out-str (sut/install-latest {:tool tool-install-name}))] | ||
(is (re-find expected-response actual-response)))) | ||
|
||
(testing "list installed tools reflects updated version" | ||
(let [old-tool (re-pattern (str tool-install-name "\\s*com\\.github\\.seancorfield/deps-new\\s*:git\\s*v0\\.4\\.9")) | ||
expected-response (re-pattern (str tool-install-name "\\s*com\\.github\\.seancorfield/deps-new")) | ||
actual-response (with-out-str (sut/list nil))] | ||
(is (not (re-find old-tool actual-response)) "The old tool was not successfully updated") | ||
(is (re-find expected-response actual-response)))) | ||
|
||
(testing "remove installed tool" | ||
(let [removal-response (with-out-str (sut/remove {:tool tool-install-name})) | ||
list-response (with-out-str (sut/list nil))] | ||
(is (str/includes? removal-response "Tool removed")) | ||
(is (not (str/includes? list-response tool-install-name)) "The tool was not successfully removed")))) | ||
|
||
(deftest install-latest-git-procurer-with-provided-coord | ||
(testing "Installed latest version of tool, for git procurer providing coord" | ||
(let [expected-response (re-pattern (str tool-install-name ": Installed com\\.github\\.seancorfield/deps-new")) | ||
actual-response (with-out-str (sut/install-latest {:lib 'com.github.seancorfield/deps-new | ||
:coord {:git/url "https://github.com/seancorfield/deps-new"} | ||
:as tool-install-name}))] | ||
(is (re-find expected-response actual-response)))) | ||
|
||
(testing "remove installed tool" | ||
(let [removal-response (with-out-str (sut/remove {:tool tool-install-name})) | ||
list-response (with-out-str (sut/list nil))] | ||
(is (str/includes? removal-response "Tool removed")) | ||
(is (not (str/includes? list-response tool-install-name)) "The tool was not successfully removed")))) |