File: testable.ml

package info (click to toggle)
yojson 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,216 kB
  • sloc: ml: 3,890; makefile: 28
file content (15 lines) | stat: -rw-r--r-- 537 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
let yojson = Alcotest.testable Yojson.Safe.pp Yojson.Safe.equal

let variant_kind_pp fmt = function
  | `Edgy_bracket -> Format.fprintf fmt "`Edgy_bracket"
  | `Square_bracket -> Format.fprintf fmt "`Square_bracket"
  | `Double_quote -> Format.fprintf fmt "`Double_quote"

let variant_kind_equal a b =
  match (a, b) with
  | `Edgy_bracket, `Edgy_bracket -> true
  | `Square_bracket, `Square_bracket -> true
  | `Double_quote, `Double_quote -> true
  | _ -> false

let variant_kind = Alcotest.testable variant_kind_pp variant_kind_equal