1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
open! Core
module M (X : Sexpable) = struct
module N (Y : sig
val x : X.t
end) =
struct
let%expect_test "trailing output" =
let sexp = X.sexp_of_t Y.x in
print_s sexp;
[%expect
{|
"a\
\nb\
\nc"
|}]
;;
let%expect_test "error" =
if String.length (string_of_sexp (X.sexp_of_t Y.x)) > 1
then raise_s (Base.Sexp.message "sexp is too long" [ "input: ", X.sexp_of_t Y.x ])
[@@expect.uncaught_exn
{|
("sexp is too long" ("input: " "a\
\nb\
\nc"))
|}]
;;
end
end
module String_tests = M (String)
module Run_on_abc = String_tests.N (struct
let x = "a\nb\nc"
end)
|