我只是在玩midje的某个项目。core_test.clj:
(ns pcc.core-test
(:use [clojure.repl])
(:require [clojure.test :refer :all]
[clojure.string :as string]
[green-tags.core :as core]
[me.raynes.fs :as fs]
[pcc.core :refer :all]
[midje.sweet :refer :all]))
(println "You should expect to see one failure below.")
(facts
"About miscellaneous functions"
(fact
"Returns a zero padded string representation of integer"
(zero-pad 1 4) => "0001"
(zero-pad 15111 4) => "15111"
(zero-pad 2 5) => "00002")
(fact
"Returns a path stripped of extension, if any"
(strip-file-ext "/alfa/bravo/charlie.dat") => "/alfa/bravo/charlie"
(strip-file-ext "/alfa/bravo/charlie") => "/alfa/bravo/charlie"
(strip-file-ext "/alfa/bravo/charlie/") => "/alfa/bravo/charlie"
(strip-file-ext "/alfa/bra.vo/charlie.dat") => "/alfa/bra.vo/charlie"))lein测试的输出
$ lein test
You should expect to see one failure below.
FAIL "About miscellaneous functions - Returns a path stripped of extension, if any" at (core_test.clj:24)
Expected: "/alfa/bravo/charlie"
Actual: "/alfa/bravo/charlie/"
You should expect to see one failure below.
FAIL "About miscellaneous functions - Returns a path stripped of extension, if any" at (core_test.clj:24)
Expected: "/alfa/bravo/charlie"
Actual: "/alfa/bravo/charlie/"
lein test user
Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
$只是跑了两次。奇怪的是,基本的lein新midje项目只运行了一次,但我看不出有什么实质性的区别。
发布于 2014-12-08 18:40:40
按照https://github.com/marick/Midje/wiki/A-tutorial-introduction,midje的目的是通过lein midje命令而不是lein test来运行测试。
从您粘贴的代码来看,您不需要在您的[clojure.test :refer :all]上使用require
要创建一个新的midje测试套件,正确的命令是lein new midje <<projectname>>,不确定是否只是在帖子上过早地关闭了粗体标记。
希望它能帮上忙
https://stackoverflow.com/questions/27317845
复制相似问题