Skip to content

Commit 685c54e

Browse files
ericdalloeca
andcommitted
Fix Windows test failures in cache_test by using paths instead of URIs
Tests passed `identity` as uri->filename-fn but used `file:///` URIs, causing InvalidPathException on Windows due to the colon in `file:`. 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <noreply@eca.dev>
1 parent 5828c7e commit 685c54e

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

test/eca/cache_test.clj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@
5050
(deftest workspace-dir-name-test
5151
(let [dir-name #'cache/workspace-dir-name]
5252
(testing "prefixes hash with project name from first workspace URI"
53-
(let [workspaces [{:uri "file:///home/user/my-project"}]
53+
(let [workspaces [{:uri "/home/user/my-project"}]
5454
result (dir-name workspaces identity)]
5555
(is (re-matches #"my-project_.{8}" result))))
5656

5757
(testing "sanitizes unsafe filesystem characters"
58-
(let [workspaces [{:uri "file:///home/user/my project@v2!"}]
58+
(let [workspaces [{:uri "/home/user/my project@v2!"}]
5959
result (dir-name workspaces identity)]
6060
(is (re-matches #"my_project_v2__.{8}" result))
6161
(is (nil? (re-find #"[ @!]" result)))))
6262

6363
(testing "truncates long project names to 30 chars"
6464
(let [long-name (apply str (repeat 50 "a"))
65-
workspaces [{:uri (str "file:///home/user/" long-name)}]
65+
workspaces [{:uri (str "/home/user/" long-name)}]
6666
result (dir-name workspaces identity)]
6767
(is (<= (count result) (+ 30 1 8)))))
6868

@@ -71,15 +71,15 @@
7171
(is (re-matches #".{8}" result))))
7272

7373
(testing "uses first workspace name when multiple workspaces"
74-
(let [workspaces [{:uri "file:///home/user/first-project"}
75-
{:uri "file:///home/user/second-project"}]
74+
(let [workspaces [{:uri "/home/user/first-project"}
75+
{:uri "/home/user/second-project"}]
7676
result (dir-name workspaces identity)]
7777
(is (re-matches #"first-project_.{8}" result))))))
7878

7979
(deftest workspace-cache-file-migration-test
8080
(testing "migrates old hash-only directory to new format"
8181
(with-temp-cache-dir
82-
(let [workspaces [{:uri "file:///home/user/my-project"}]
82+
(let [workspaces [{:uri "/home/user/my-project"}]
8383
hash-only (cache/workspaces-hash workspaces identity)
8484
old-dir (io/file (cache/global-dir) hash-only)]
8585
;; Create old-format directory with a cache file
@@ -94,7 +94,7 @@
9494

9595
(testing "does not migrate when new directory already exists"
9696
(with-temp-cache-dir
97-
(let [workspaces [{:uri "file:///home/user/my-project"}]
97+
(let [workspaces [{:uri "/home/user/my-project"}]
9898
hash-only (cache/workspaces-hash workspaces identity)
9999
old-dir (io/file (cache/global-dir) hash-only)
100100
result-before (cache/workspace-cache-file workspaces "db.transit.json" identity)

0 commit comments

Comments
 (0)