Skip to content

Commit

Permalink
ppx native: add yojson as runtime dep
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Sep 2, 2024
1 parent 50d9adb commit 5212cbb
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ppx/native/dune
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ppx_deriving_json_runtime
ppx_deriving_json_native_test)
(libraries ppxlib)
(ppx_runtime_libraries melange-json-native.ppx-runtime)
(ppx_runtime_libraries melange-json-native.ppx-runtime yojson)
(preprocess
(pps ppxlib.metaquot))
(kind ppx_deriver))
Expand Down
62 changes: 52 additions & 10 deletions ppx/test/ppx_deriving_json_native.e2e.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,57 @@
> ' >> main.ml

$ dune build ./main.exe
File "example.ml", line 1, characters 0-33:
1 | type user = int [@@deriving json]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module Yojson
[1]

$ dune exec ./main.exe
File "example.ml", line 1, characters 0-33:
1 | type user = int [@@deriving json]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound module Yojson
[1]
JSON DATA: 1
JSON REPRINT: 1
JSON DATA: "OK"
JSON REPRINT: "OK"
JSON DATA: "some"
JSON REPRINT: "some"
JSON DATA: ["Ok", 1]
JSON REPRINT: ["Ok",1]
JSON DATA: ["Error", "oops"]
JSON REPRINT: ["Error","oops"]
JSON DATA: [42, "works"]
JSON REPRINT: [42,"works"]
JSON DATA: {"name":"N","age":1}
JSON REPRINT: {"name":"N","age":1}
JSON DATA: ["A"]
JSON REPRINT: ["A"]
JSON DATA: ["B", 42]
JSON REPRINT: ["B",42]
JSON DATA: ["C", {"name": "cname"}]
JSON REPRINT: ["C",{"name":"cname"}]
JSON DATA: ["A"]
JSON REPRINT: ["A"]
JSON DATA: ["B", 42]
JSON REPRINT: ["B",42]
JSON DATA: ["Fix",["Fix",["Fix",["A"]]]]
JSON REPRINT: ["Fix",["Fix",["Fix",["A"]]]]
JSON DATA: ["Fix",["Fix",["Fix",["A"]]]]
JSON REPRINT: ["Fix",["Fix",["Fix",["A"]]]]
JSON DATA: "A"
JSON REPRINT: "A"
JSON DATA: "b_aliased"
JSON REPRINT: "b_aliased"
JSON DATA: "b"
JSON REPRINT: "b"
JSON DATA: "A_aliased"
JSON REPRINT: "A_aliased"
JSON DATA: {"my_name":"N","my_age":1}
JSON REPRINT: {"my_name":"N","my_age":1}
JSON DATA: {"my_name":"N"}
JSON REPRINT: {"my_name":"N","my_age":100}
JSON DATA: {}
JSON REPRINT: {"k":null}
JSON DATA: {"k":42}
JSON REPRINT: {"k":42}
JSON DATA: ["A",1]
JSON REPRINT: ["A",1]
JSON DATA: ["B","ok"]
JSON REPRINT: ["B","ok"]
JSON DATA: {"a":1,"b":2}
JSON REPRINT: {"a":1}
JSON DATA: ["A",{"a":1,"b":2}]
JSON REPRINT: ["A",{"a":1}]

0 comments on commit 5212cbb

Please sign in to comment.