From acad46dc66540534656cb155fcd623eea3cfb965 Mon Sep 17 00:00:00 2001 From: jem Date: Fri, 14 Feb 2020 19:49:39 +0100 Subject: [PATCH] add test for space containing file names --- fs_root/File With Space | 0 .../classpath_able_io/fs_test.clj | 32 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 fs_root/File With Space diff --git a/fs_root/File With Space b/fs_root/File With Space new file mode 100644 index 0000000..e69de29 diff --git a/test/cryogen_core/classpath_able_io/fs_test.clj b/test/cryogen_core/classpath_able_io/fs_test.clj index 5b89366..72fc070 100644 --- a/test/cryogen_core/classpath_able_io/fs_test.clj +++ b/test/cryogen_core/classpath_able_io/fs_test.clj @@ -8,8 +8,6 @@ (ns cryogen-core.classpath-able-io.fs-test (:require [clojure.test :refer :all] - [clojure.java.io :as io] - [schema.core :as s] [cryogen-core.file-test-tools :as ftt] [cryogen-core.classpath-able-io.fs :as sut])) @@ -23,26 +21,40 @@ (= (str (sut/user-dir) "/" fs-root "/not-existing") (.toString (sut/absolut-path (str fs-root "/not-existing")))))) -(deftest test-path-if-exists - (is - (sut/path-if-exists (str fs-root "/dummy/dummy_from_fs"))) +(deftest should-return-nil-on-not-existing-path (is (= nil - (sut/path-if-exists (str fs-root "/not-existing"))))) + (sut/path-if-exists fs-root "not-existing")))) + +(deftest should-find-subdir-path + (is + (sut/path-if-exists fs-root "/dummy/dummy_from_fs"))) + +(deftest should-find-path-with-space + (is + (sut/path-if-exists fs-root "/File With Space"))) + +(deftest should-find-path-empty-base-path + (is + (sut/path-if-exists fs-root "" "/dummy/dummy_from_fs"))) + (deftest test-list-entries-for-dir (is - (= ["dummy2" "dummy_from_fs"] + (= ["dummy2" + "dummy_from_fs"] (sort (seq (sut/list-entries-for-dir (sut/create-resource "dummy" (sut/path-if-exists fs-root "dummy") :filesytem))))))) (deftest test-get-resources - ; TODO: base path should not be empty (is - (= ["dummy" "dummy/dummy2" "dummy/dummy2/dummy2_from_fs" - "dummy/dummy2/dummy_common" "dummy/dummy_from_fs"] + (= ["dummy" + "dummy/dummy2" + "dummy/dummy2/dummy2_from_fs" + "dummy/dummy2/dummy_common" + "dummy/dummy_from_fs"] (sort (map ftt/filter-path (sut/get-resources fs-root "" ["dummy"]))))) (is