如何获得ocp-build来运行ocaml项目的oUnit测试?

时间:2015-05-28 21:24:50

标签: ocaml typerex

我已经建立了一个使用ocp-build的小型ocaml项目。我建立得很好,但是 我无法弄清楚如何运行oUnit测试,也找不到任何好处 在线示例。

我的项目布局如下:

-sample_project
 |-src
 | |-main
 | | |-build.ocp
 | | |-main.ml
 | |-test
 |   |-test.ml
 |   |-test.ocp 

main.ml只是“hello world”test.ml是来自oUnit网站的一个示例测试。

构建文件包含:

build.ocp:

begin program "hello"
  files = [ "main.ml"]
  requires = [ "batteries" ]
end

test.ocp:

begin program "run_test"
  files = [ "test.ml"]
  requires = [ "oUnit" ]
end

begin test "test"
  files = [ ]
  requires = [ "run_test" ]
  test_cmd = "run_test"
  tests = [ "test_list_length" ]
end

这是我运行ocp-build的输出:

sample_project>ocp-build -test
find_project_root
Warning: Could not find OCaml ocamldoc tool.
Warning: 4 missing and 2 disabled (use -print-missing)
Updating ocp-build.root
Warning: 2 missing and 1 disabled (use -print-missing)
Warning: 5 package conflicts solved (use -print-conflicts)
Build Successful in 0.13s. 0 jobs (parallelism 0.0x), 0 files generated.

sample_project>ocp-build tests
find_project_root
Warning: Could not find OCaml ocamldoc tool.
Warning: 4 missing and 2 disabled (use -print-missing)
Updating ocp-build.root
Warning: 2 missing and 1 disabled (use -print-missing)
Warning: 5 package conflicts solved (use -print-conflicts)
Error: project contains no targets
        Are your .ocp files empty ?

测试旨在失败(并且在以字节码形式运行时失败)。

即使是ocp-build项目本身(我在线获得了源代码),它已经定义了测试,但似乎不起作用。 (我获得与我的示例项目类似的输出。)

提前致谢。

1 个答案:

答案 0 :(得分:0)

我最终使用的是oasis,并且最终可能会切换到最终。