Add tests for tuple enum variants

This commit is contained in:
Graham Esau 2019-09-07 15:25:06 +01:00
parent c2e8389e93
commit 07f4f68a02
4 changed files with 40 additions and 4 deletions

View file

@ -7,8 +7,9 @@ use util::*;
pub enum External {
UnitOne,
StringMap(Map<String, String>),
Struct{ foo: i32, bar: bool },
Struct { foo: i32, bar: bool },
UnitTwo,
Tuple(i32, bool),
}
#[test]
@ -21,7 +22,7 @@ fn enum_external_tag() -> TestResult {
pub enum Internal {
UnitOne,
StringMap(Map<String, String>),
Struct{ foo: i32, bar: bool },
Struct { foo: i32, bar: bool },
UnitTwo,
}
@ -35,7 +36,8 @@ fn enum_internal_tag() -> TestResult {
pub enum Untagged {
UnitOne,
StringMap(Map<String, String>),
Struct{ foo: i32, bar: bool }
Struct { foo: i32, bar: bool },
Tuple(i32, bool),
}
#[test]

View file

@ -44,6 +44,27 @@
"required": [
"struct"
]
},
{
"type": "object",
"properties": {
"tuple": {
"type": "array",
"items": [
{
"type": "integer"
},
{
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
}
},
"required": [
"tuple"
]
}
]
}

View file

@ -25,6 +25,19 @@
"bar",
"foo"
]
},
{
"type": "array",
"items": [
{
"type": "integer"
},
{
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
}
]
}