* Add tests for markdown-clj and tools.namespace
See comment for why only one markdown test could be run.
Closes #1069 and #1064
* Convert 10 test libs using add-libtest
Also improved add-libtest to only require maven artifact
and rely on clojars for getting git-url most of the time
* Convert 8 more test libs using add-libtest
Also updated table and added comment for newline test
* Fix doric test
* Disable tools.namespace test that fails on windows
* Added dozen manual test libs and converted 2 test libs
add-libtest.clj supports manually-added and test-directories options
* Converts last tests to test namespaces and write libraries.csv
* Add a number of library tests from projects.md
Also add more docs around adding test libs and tweak add script
* Use :sha for gitlib and older clojure cli
* Revert "Use :sha for gitlib and older clojure cli"
This reverts commit c663ab8368.
* Fix and disable failing tests
Disabled tests that fail consistently and fixed windows one
52 lines
2 KiB
Clojure
52 lines
2 KiB
Clojure
(ns clojure.tools.namespace.move-test
|
|
(:require [clojure.java.io :as io]
|
|
[clojure.test :refer [deftest is]]
|
|
[clojure.tools.namespace.move :refer [move-ns]]
|
|
[clojure.tools.namespace.test-helpers :as help])
|
|
(:import (java.io File)))
|
|
|
|
(defn- create-file-one [dir]
|
|
(help/create-source dir 'example.one :clj
|
|
'[example.two example.three]
|
|
'[(defn foo []
|
|
(example.a.four/foo))]))
|
|
|
|
(defn- create-file-two [dir]
|
|
(help/create-source dir 'example.two :clj
|
|
'[example.three example.a.four]))
|
|
|
|
(defn- create-file-three [dir]
|
|
(help/create-source dir 'example.three :clj
|
|
'[example.five]))
|
|
|
|
(defn- create-file-four [dir]
|
|
(help/create-source dir 'example.a.four :clj))
|
|
|
|
(deftest t-move-ns
|
|
(let [temp-dir (help/create-temp-dir "tools-namespace-t-move-ns")
|
|
src-dir (io/file temp-dir "src")
|
|
example-dir (io/file temp-dir "src" "example")
|
|
file-one (create-file-one src-dir)
|
|
file-two (create-file-two src-dir)
|
|
file-three (create-file-three src-dir)
|
|
old-file-four (create-file-four src-dir)
|
|
new-file-four (io/file example-dir "b" "four.clj")]
|
|
|
|
(let [file-three-last-modified (.lastModified file-three)]
|
|
|
|
(Thread/sleep 1500) ;; ensure file timestamps are different
|
|
|
|
(move-ns 'example.a.four 'example.b.four src-dir [src-dir])
|
|
|
|
(is (.exists new-file-four)
|
|
"new file should exist")
|
|
(is (not (.exists old-file-four))
|
|
"old file should not exist")
|
|
(is (not (.exists (.getParentFile old-file-four)))
|
|
"old empty directory should not exist")
|
|
(is (= file-three-last-modified (.lastModified file-three))
|
|
"unaffected file should not have been modified")
|
|
(is (not-any? #(.contains (slurp %) "example.a.four")
|
|
[file-one file-two file-three new-file-four]))
|
|
(is (every? #(.contains (slurp %) "example.b.four")
|
|
[file-one file-two new-file-four])))))
|