【发布时间】:2018-11-15 10:34:19
【问题描述】:
我在运行 OUnit 测试时遇到了困难,主要是因为我对沙丘和 OUnit 都不熟悉。 dune 在我运行 dune runtest 时抱怨:
File "test/dune", line 4, characters 13-14:
Error: Library "f" not found.
Hint: try: dune external-lib-deps --missing @runtest
这是项目结构:
├── dune
├── f.ml # This is the source file.
└── test
├── dune
└── f_test.ml # This is the test.
这是dune:
(executable
(name f))
这是test/dune:
(test
(name f_test)
(libraries oUnit f)) ; <- `f` here causes problems.
我可以看到错误出现是因为沙丘不知道f.ml,因此不知道沙丘文件中的f。
我怎样才能让 dune 编译 f.ml 以使 test/dune 知道我在 test/f_test.ml 中使用的 f 库?如何正确运行单元测试?
【问题讨论】:
标签: ocaml ounit ocaml-dune