mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
compat with 4.03
This commit is contained in:
parent
bad23766e3
commit
565b3ed5c2
1 changed files with 2 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ module Test = struct
|
||||||
self.hex pp_expect self.expect self.roundtrip
|
self.hex pp_expect self.expect self.roundtrip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let list_assoc_opt x l = try Some (List.assoc x l) with _ -> None
|
||||||
|
|
||||||
let extract_tests (j:json) : Test.t list =
|
let extract_tests (j:json) : Test.t list =
|
||||||
let l = J.Util.to_list j in
|
let l = J.Util.to_list j in
|
||||||
|
|
@ -37,7 +38,7 @@ let extract_tests (j:json) : Test.t list =
|
||||||
let raw = CCString.of_hex_exn @@ hex in
|
let raw = CCString.of_hex_exn @@ hex in
|
||||||
let roundtrip = J.Util.to_bool @@ List.assoc "roundtrip" o in
|
let roundtrip = J.Util.to_bool @@ List.assoc "roundtrip" o in
|
||||||
let expect =
|
let expect =
|
||||||
match List.assoc_opt "decoded" o, List.assoc_opt "diagnostic" o with
|
match list_assoc_opt "decoded" o, list_assoc_opt "diagnostic" o with
|
||||||
| None, Some (`String s) -> Test.Diagnostic s
|
| None, Some (`String s) -> Test.Diagnostic s
|
||||||
| Some o, _ -> Test.Decoded o
|
| Some o, _ -> Test.Decoded o
|
||||||
| _ -> failwith "cannot find expected result"
|
| _ -> failwith "cannot find expected result"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue