Skip to content

Commit c5beb1b

Browse files
committed
dhall-json: test for type encoding
1 parent 552cffb commit c5beb1b

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

dhall-json/tasty/Main.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ testTree =
3434
, testDhallToJSON "./tasty/data/emptyObjectStrongType"
3535
, testDhallToJSON "./tasty/data/toArbitraryJSON_12_0_0"
3636
, testDhallToJSON "./tasty/data/toArbitraryJSON_13_0_0"
37+
, testDhallToJSON "./tasty/data/types"
3738
, testJSONToDhall "./tasty/data/emptyAlternative"
3839
, testJSONToDhall "./tasty/data/emptyObject"
3940
, testJSONToDhall "./tasty/data/emptyList"

dhall-json/tasty/data/types.dhall

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
field: Text,
3+
nested: { nested_field: Natural },
4+
list: List Bool,
5+
optional: Optional Text,
6+
union: < A: Natural | B: Text | C >
7+
}

dhall-json/tasty/data/types.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"fields": {
3+
"field": "Text",
4+
"list": {
5+
"element": "Bool",
6+
"type": "List"
7+
},
8+
"nested": {
9+
"fields": {
10+
"nested_field": "Natural"
11+
},
12+
"type": "Record"
13+
},
14+
"optional": {
15+
"element": "Text",
16+
"type": "Optional"
17+
},
18+
"union": {
19+
"choices": {
20+
"A": "Natural",
21+
"B": "Text",
22+
"C": {}
23+
},
24+
"type": "Union"
25+
}
26+
},
27+
"type": "Record"
28+
}

0 commit comments

Comments
 (0)