Test macro [skip ci]
This commit is contained in:
parent
a44f07a665
commit
6e4313700f
1 changed files with 13 additions and 9 deletions
|
|
@ -12,15 +12,19 @@
|
||||||
:eof nil}
|
:eof nil}
|
||||||
(apply test-utils/bb nil (map str args))))
|
(apply test-utils/bb nil (map str args))))
|
||||||
|
|
||||||
|
(defmacro with-config [cfg & body]
|
||||||
|
`(let [temp-dir# (fs/create-temp-dir)
|
||||||
|
bb-edn-file# (fs/file temp-dir# "bb.edn")]
|
||||||
|
(spit bb-edn-file# ~cfg)
|
||||||
|
(binding [test-utils/*bb-edn-path* (str bb-edn-file#)]
|
||||||
|
~@body)))
|
||||||
|
|
||||||
(deftest foobar-test
|
(deftest foobar-test
|
||||||
(let [temp-dir (fs/create-temp-dir)
|
(let [temp-dir (fs/create-temp-dir)
|
||||||
temp-file (fs/create-file (fs/path temp-dir "temp-file.txt"))
|
temp-file (fs/create-file (fs/path temp-dir "temp-file.txt"))]
|
||||||
bb-edn-file (fs/file temp-dir "bb.edn")
|
(with-config {:tasks {:clean {:task/type :shell
|
||||||
bb-edn `{:tasks {:clean {:task/type :shell
|
:args ["rm" (str temp-file)]}}}
|
||||||
:args ["rm" ~(str temp-file)]}}}]
|
(is (fs/exists? temp-file))
|
||||||
(spit bb-edn-file bb-edn)
|
(bb :clean)
|
||||||
(is (fs/exists? temp-file))
|
(is (not (fs/exists? temp-file))))))
|
||||||
(binding [test-utils/*bb-edn-path* (str bb-edn-file)]
|
|
||||||
(bb :clean))
|
|
||||||
(is (not (fs/exists? temp-file)))))
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue