File tree Expand file tree Collapse file tree 10 files changed +11
-42
lines changed Expand file tree Collapse file tree 10 files changed +11
-42
lines changed Original file line number Diff line number Diff line change 1010 - OCAML_VERSION=4.02
1111 - OCAML_VERSION=4.03
1212 - OCAML_VERSION=4.04
13+ - OCAML_VERSION=4.06
1314os :
1415 - linux
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ build: [
1818
1919depends: [
2020 "ezjsonm"
21- "ocamlfind" {build}
2221 "jbuilder" {build & >="1.0+beta9"}
2322 "alcotest" {test & >= "0.4.0"}
2423 "jsonm" {>= "0.9.1"}
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -244,22 +244,24 @@ let map f t path =
244244 | h ::tl ->
245245 match t with
246246 | `O d -> Some (`O (map_dict (fun t -> aux t tl) d h))
247- | j -> None in
247+ | _ -> None in
248248 match aux t path with
249249 | None -> raise Not_found
250250 | Some j -> j
251251
252252let update t path v =
253253 map (fun _ -> v) t path
254254
255+ exception Not_utf8
256+
255257let is_valid_utf8 str =
256258 try
257259 Uutf.String. fold_utf_8 (fun _ _ -> function
258- | `Malformed _ -> raise ( Failure " utf8 " )
260+ | `Malformed _ -> raise Not_utf8
259261 | _ -> ()
260262 ) () str;
261263 true
262- with Failure "utf8" -> false
264+ with Not_utf8 -> false
263265
264266let encode_string str =
265267 if is_valid_utf8 str
@@ -271,7 +273,7 @@ let encode_string str =
271273let decode_string = function
272274 | `String str -> Some str
273275 | `O [ " hex" , `String str ] -> Some (Hex. to_string (`Hex str))
274- | j -> None
276+ | _ -> None
275277
276278let decode_string_exn j =
277279 match decode_string j with
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -29,7 +29,8 @@ let from_stream (stream: string Lwt_stream.t): value Lwt_stream.t =
2929 Lwt_stream. get stream >> = function
3030 | None -> Lwt. fail (Escape (Jsonm. decoded_range d, (`Expected `Value )))
3131 | Some str ->
32- Jsonm.Manual. src d str 0 (String. length str);
32+ let bytes = Bytes. of_string str in
33+ Jsonm.Manual. src d bytes 0 (Bytes. length bytes);
3334 dec ()
3435 in
3536 let rec value v k = match v with
@@ -56,7 +57,7 @@ let from_stream (stream: string Lwt_stream.t): value Lwt_stream.t =
5657 let open_stream () =
5758 dec () >> = function
5859 | `As -> Lwt. return_unit
59- | l -> Lwt. fail (Escape (Jsonm. decoded_range d, `Expected (`Aval true )))
60+ | _ -> Lwt. fail (Escape (Jsonm. decoded_range d, `Expected (`Aval true )))
6061 in
6162 let get () =
6263 dec () >> = fun v ->
Original file line number Diff line number Diff line change 1- open Alcotest
2-
31(* Check we're compatible with sexplib *)
42type test = {
53 foo : Ezjsonm .value ;
@@ -29,7 +27,7 @@ let random_string len =
2927 for i = 0 to Bytes. length s - 1 do
3028 Bytes. set s i @@ Char. chr (random_int 127 )
3129 done ;
32- s
30+ Bytes. to_string s
3331
3432let random_list len gen =
3533 Array. to_list (Array. init len gen)
You can’t perform that action at this time.
0 commit comments