From 127fd9cbfe601e1566cbfb2a4939fba337833602 Mon Sep 17 00:00:00 2001 From: jem Date: Thu, 30 Jan 2020 12:11:13 +0100 Subject: [PATCH] remove direct file deps from test --- test/cryogen_core/classpath_able_io_test.clj | 8 ++++---- test/cryogen_core/file_test_tools.clj | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/test/cryogen_core/classpath_able_io_test.clj b/test/cryogen_core/classpath_able_io_test.clj index 2dedde7..33e3e14 100644 --- a/test/cryogen_core/classpath_able_io_test.clj +++ b/test/cryogen_core/classpath_able_io_test.clj @@ -30,17 +30,17 @@ "" "dummy"))) (is - (Files/exists + (ftt/verify-path-exists (:java-path (sut/resource-from-cp-or-fs "./test-resources" "templates/themes/bootstrap4-test" - "js")) sut/no-link-option)) + "js")))) (is - (Files/exists + (ftt/verify-path-exists (:java-path (sut/resource-from-cp-or-fs - "./" "" ".gitkeep")) sut/no-link-option)) + "./" "" ".gitkeep")))) (is (some? (sut/resource-from-cp-or-fs "./test-resources" diff --git a/test/cryogen_core/file_test_tools.clj b/test/cryogen_core/file_test_tools.clj index 3594ac0..ea99ce3 100644 --- a/test/cryogen_core/file_test_tools.clj +++ b/test/cryogen_core/file_test_tools.clj @@ -8,10 +8,16 @@ (ns cryogen-core.file-test-tools (:require [clojure.java.io :as io] - [schema.core :as s])) + [schema.core :as s]) + (:import [java.nio.file Files LinkOption])) + +(def no-link-option (into-array [LinkOption/NOFOLLOW_LINKS])) + +(defn verify-path-exists [path] + (Files/exists path no-link-option)) (defn verify-file-exists [path] - (.exists (io/file path))) + (io/file path)) (defn verify-dir-exists [path] (and (verify-file-exists path)