File: test_util.ml

package info (click to toggle)
ocaml-mdx 2.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,560 kB
  • sloc: ml: 6,940; sh: 18; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 766 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
module String = struct
  let test_english_conjonction =
    let make_test ~name ~input ~expected () =
      let test_name = Printf.sprintf "String.english_conjonction: %s" name in
      let test_fun () =
        let actual = Mdx.Util.String.english_conjonction input in
        Alcotest.(check string test_name expected actual)
      in
      (test_name, `Quick, test_fun)
    in
    [
      make_test ~name:"single" ~input:[ "a" ] ~expected:"a" ();
      make_test ~name:"two" ~input:[ "a"; "b" ] ~expected:"a and b" ();
      make_test ~name:"three" ~input:[ "a"; "b"; "c" ] ~expected:"a, b and c" ();
      make_test ~name:"more" ~input:[ "a"; "b"; "c"; "d" ]
        ~expected:"a, b, c and d" ();
    ]
end

let suite = ("Util", String.test_english_conjonction)