Debian Codegraph @

apps/json/tests-plugin/test.v

raw
1
2 From elpi Require Import elpi json.
3 From elpi Require json.tests.dummy. (* work around missing dune support for Extra Dependency *)
4
5 Elpi Command test.
6 Elpi Accumulate Plugin "json.elpi".
7 Fail Elpi Query lp:{{
8 std.assert-ok! (json.from_file "foo.json" X) "json"
9 }}.
10
11 From elpi.json.tests Extra Dependency "test.json" as json_test_file.
12
13
14 Elpi Query lp:{{
15 coq.extra-dep "json_test_file" (some Path),
16 std.assert-ok! (json.from_file Path X) "json",
17 coq.say X,
18 std.assert! ( X = json.assoc [pr "address" A| _]) "json",
19 std.assert! ( A = json.assoc [pr "city" (json.string "New York")| _]) "json",
20 Path1 is Path ^ ".out",
21 std.assert-ok! (json.to_file Path1 X) "json"
22 }}.
23
24