We have the following function I want to test:
let string__to__sexp_with_layout (s : string) : Sexp_with_layout.t_or_comment =
let lexbuf = Lexing.from_string s in
Sexp_with_layout.(Parser.sexp Lexer.main lexbuf)
let%test_unit "string__to__sexp_with_layout" =
[%test_eq: Sexp_with_layout.t_or_comment] (string__to__sexp_with_layout "23")
...
So basically I want to test the parser function on an input of “23” by writing out the literal Sexp.Sexp_with_layout.t_or_comment struct that we generate.
However, the problem I am running into is that compare
is apparently not defined on this type. Is there a way to write this unit test ?