Reputation: 31586
I followed the following steps to create my project
Create the project using the following dune command
dune init proj --kind=lib mymaps
Then added 2 files under the "lib" directory
mymaps.mli
type ('k, 'v) t
val empty : ('k, 'v) t
val insert : 'k -> 'v -> ('k, 'v) t -> ('k, 'v) t
mymaps.ml
type ('k, 'v) t = ('k * 'v) list
let rec insert k v m = match m with
| [] -> [(k, v)]
| (eK, eV) :: tl -> let (nK, nV) = if (eK = k) then (k, v) else (eK, eV) in
(nK, nV) :: insert k v tl
let empty = []
mymaps_tests.ml
open Ounit2
open Mymaps
let empty_test =
"empty has no bindings" >:: (fun _ -> assert_equal [] (empty));
let mymap_tests = [empty_test]
let suite = "maps suite" >::: mymap_tests
let _ = run_test_tt_main suite
However when I go to command line and say dune build
it says
File "test/dune", line 2, characters 7-13:
2 | (name mymaps))
^^^^^^
Error: Module "Mymaps" doesn't exist.
Here is the link to GitHub for my work https://github.com/abhsrivastava/mymaps
I am following a tutorial on YouTube and I didn't see them implement any modules for the test project, they straight wrote the test. Not sure why is it looking for another Mymaps under test.
Upvotes: 0
Views: 474
Reputation: 31586
I think I found out the issue. the name of the test file should be the same as the name of the project. I renamed my tests file to "mymaps.ml" and then the error went away.
Upvotes: 0