Skip to content

Commit

Permalink
Add more strings to test for parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Jan 3, 2025
1 parent 41ed163 commit f30dc86
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
13 changes: 13 additions & 0 deletions tests/core/dune
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,16 @@
(system
"cd json5 && find . -type f | egrep '\\.json|\\.js|\\.txt' | xargs -I % mv % .")
(system "cd json5 && find . -type d | grep -v '^\\.$' | xargs rm -rf"))))

(rule
(alias citest)
(target big-list-of-naughty-strings)
(action
(progn
(run rm -rf big-list-of-naughty-strings)
(run
git
clone
--depth
1
https://github.com/minimaxir/big-list-of-naughty-strings.git))))
2 changes: 1 addition & 1 deletion tests/core/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
(alias citest)
(package liquidsoap)
(deps
(:json ./json) (:json5 ./json5)
(:json ./json) (:json5 ./json5) (:big-list-of-naughty-strings ./big-list-of-naughty-strings)
(:json_test json_test.exe))
(action (run %{json_test} )))

Expand Down
5 changes: 4 additions & 1 deletion tests/core/gen_dune.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
(* test name, (deps, args) *)
let test_params =
[
("json_test", ("(:json ./json) (:json5 ./json5)", [""]));
( "json_test",
( "(:json ./json) (:json5 ./json5) (:big-list-of-naughty-strings \
./big-list-of-naughty-strings)",
[""] ) );
( "stream_decoder_test",
( "(:test_wav ./test.wav) (:test_mp3 ./test.mp3)",
["%{test_wav} bla.wav"; "%{test_mp3} bla.wav"] ) );
Expand Down
10 changes: 10 additions & 0 deletions tests/core/json_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,13 @@ let () =
| _ when expectation = `Failure -> Printf.printf "OK!\n%!"
in
List.iter run_test tests

let () =
let pwd = Filename.dirname Sys.argv.(0) in
let basedir = Filename.concat pwd "big-list-of-naughty-strings" in
let strings_file = Filename.concat basedir "blns.json" in
Printf.printf "Testing big-list-of-naughty-strings...\n%!";
let s = read_file strings_file in
let v = Json.from_string s in
ignore (Json.to_string ~compact:true v);
ignore (Json.to_string ~compact:false v)

0 comments on commit f30dc86

Please sign in to comment.