simple-diff icon indicating copy to clipboard operation
simple-diff copied to clipboard

Help with writing tests

Open gjaldon opened this issue 8 years ago • 1 comments

Hi there, @hannesm! I'm trying to ship my first ocaml package but getting stuck on the testing part. I want to write a test for Main.get_diff (I will rename the Main module to SimpleDiff later on).

I don't understand how to use Alcotest.(check type) and don't get what pp should be in Alcotest.TESTABLE. Here's what I have, so far (doesn't work):

https://github.com/gjaldon/simple_diff/blob/master/src_test/test.ml#L9

I still don't grok Fmt/Formatter so will need to read up more about that.

gjaldon avatar Jan 06 '17 18:01 gjaldon

Formatter documentation: tutorial, API, and Fmt

See for example str_err which takes a string (and thus pp is just pp_string), but comparison is always true (error messages).

hannesm avatar Jan 07 '17 14:01 hannesm