Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pod tests pass, and run them from make #567

Merged
merged 3 commits into from Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -96,7 +96,7 @@ deploy: .deployed

.tested: bin/boot
(export BOOT_VERSION=$(version) && export BOOT_EMIT_TARGET=no && cd boot/core && ../../bin/boot -x test)
# (cd boot/pod && lein test)
(cd boot/pod && lein test)
date > .tested

test: .installed .tested
30 changes: 13 additions & 17 deletions boot/pod/test/boot/file_test.clj
@@ -1,6 +1,7 @@
(ns boot.file-test
(:refer-clojure :exclude [sync file-seq])
(:require
[clojure.string :as str]
[clojure.test :refer :all]
[boot.file :as file :refer :all :exclude [name]]
[clojure.java.io :as io]))
Expand All @@ -21,27 +22,22 @@
(is (not (parent? test-dir (io/file "foo/js/public/out/goog/base.js")))))

(deftest relative-to-test
(testing "Nil base"
(is (= "out/goog/base.js" (str (relative-to nil (io/file "out/goog/base.js"))))))
(let [normalize #(if-not windows? % (str/replace % #"\\" "/"))]
(testing "File inside base"
(is (= "out/goog/base.js" (str (normalize (relative-to test-dir (io/file "public/js/out/goog/base.js")))))))

(testing "File inside base"
(is (= "out/goog/base.js" (str (relative-to test-dir (io/file "public/js/out/goog/base.js"))))))
(testing "File not inside base"
(is (= "../../cljsjs/dev/react.js" (str (normalize (relative-to test-dir (io/file "cljsjs/dev/react.js")))))))

(testing "File not inside base"
(is (= "../../cljsjs/dev/react.js" (str (relative-to test-dir (io/file "cljsjs/dev/react.js"))))))
(testing "File not inside base"
(is (= "../cljsjs/dev/react.js" (str (normalize (relative-to test-dir (io/file "public/cljsjs/dev/react.js")))))))

(testing "File not inside base"
(is (= "../cljsjs/dev/react.js" (str (relative-to test-dir (io/file "public/cljsjs/dev/react.js"))))))

(testing "Two absolute paths"
(is (= "js/test.js" (str (relative-to abs-dir (io/file "/foo/bar/js/test.js"))))))
)
(testing "Two absolute paths"
(is (= "js/test.js" (str (normalize (relative-to abs-dir (io/file "/foo/bar/js/test.js")))))))))

(deftest match-filter?-test
(let [filters #{#"^META-INF/MANIFEST.MF$"}]
(testing "Unix-style paths"
(is (match-filter? filters (io/file "META-INF/MANIFEST.MF"))))
(testing "Windows-style paths"
(is (match-filter? filters (io/file "META-INF\\MANIFEST.MF"))))
(testing "Valid paths"
(is (match-filter? filters (io/file "META-INF" "MANIFEST.MF"))))
(testing "Sanity check for failure"
(is (not (match-filter? filters (io/file "META-INF/MANIFEST.NO")))))))
(is (not (match-filter? filters (io/file "META-INF" "MANIFEST.NO")))))))