File: trailing_in_module.ml

package info (click to toggle)
ppx-expect 0.17.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: ml: 3,399; ansic: 104; javascript: 19; makefile: 15; sh: 2
file content (24 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
    ;;

    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 ])
    ;;
  end
end

module String_tests = M (String)

module Run_on_abc = String_tests.N (struct
  let x = "a\nb\nc"
end)