This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
19
unikernel/duniverse/angstrom/lib_test/test_json.ml
Normal file
19
unikernel/duniverse/angstrom/lib_test/test_json.ml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
let read f =
|
||||
try
|
||||
let ic = open_in_bin f in
|
||||
let n = in_channel_length ic in
|
||||
let s = Bytes.create n in
|
||||
really_input ic s 0 n;
|
||||
close_in ic;
|
||||
let b = Bigstringaf.create n in
|
||||
Bigstringaf.blit_from_bytes s ~src_off:0 b ~dst_off:0 ~len:n;
|
||||
b
|
||||
with e ->
|
||||
failwith (Printf.sprintf "Cannot read content of %s.\n%s" f (Printexc.to_string e))
|
||||
;;
|
||||
|
||||
let () =
|
||||
let twitter_big = read Sys.argv.(1) in
|
||||
match Angstrom.(parse_bigstring ~consume:Consume.Prefix RFC7159.json twitter_big) with
|
||||
| Ok _ -> ()
|
||||
| Error err -> failwith err
|
||||
Loading…
Add table
Add a link
Reference in a new issue