【问题标题】:Unit testing in Leiningen not finding test fileLeiningen 的单元测试没有找到测试文件
【发布时间】:2012-08-17 22:44:00
【问题描述】:

对于名为 myproject 的 Lein 项目,我在 myproject/test/ 目录中创建了一个文件 core.clj。

(ns myproject.test.core
  (:use clojure.test))
  ;;tests follow

当我尝试使用“lein test”运行测试时,它失败并出现错误:

Exception in thread "main" java.io.FileNotFoundException: Could not locate myproject/test/core__init.class or myproject/test/core.clj on classpath: 

【问题讨论】:

    标签: testing clojure leiningen


    【解决方案1】:

    根据您的错误,您的目录结构似乎与我使用的不同。 lein 想要 core.clj(用于测试)在我在下面发布的目录中。这是lein new util设置的我的测试目录路径

    ~/projects/clojure/util/test/util/test$
    

    这里是 project.clj 文件,以备不时之需。

    (defproject util "1.0.4-SNAPSHOT"
      :description "A general purposes Clojure library"
      :dependencies [[org.clojure/clojure "1.4.0"]
                     [clojure-csv/clojure-csv "1.3.2"]
                     [org.clojure/tools.cli "0.1.0"]]
      :aot [util.core]
      :omit-source true)
    

    【讨论】:

    猜你喜欢
    • 2021-07-23
    • 1970-01-01
    • 2011-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多