-
-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port "either" tests to new integration test style
Also fix a bug that the new test found!
- Loading branch information
Showing
10 changed files
with
156 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use crate::prelude::*; | ||
use either1::Either; | ||
|
||
#[test] | ||
fn either() { | ||
test!(Either<i32, Either<bool, ()>>) | ||
.assert_snapshot() | ||
.assert_allows_ser_roundtrip([ | ||
Either::Left(123), | ||
Either::Right(Either::Left(true)), | ||
Either::Right(Either::Right(())), | ||
]) | ||
.assert_matches_de_roundtrip(arbitrary_values()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
schemars/tests/integration/snapshots/schemars/tests/integration/either.rs~either.de.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"title": "Either_int32_or_Either_boolean_or_null", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Left": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Left" | ||
] | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Right": { | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Left": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Left" | ||
] | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Right": { | ||
"type": "null" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Right" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Right" | ||
] | ||
} | ||
] | ||
} |
56 changes: 56 additions & 0 deletions
56
schemars/tests/integration/snapshots/schemars/tests/integration/either.rs~either.ser.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"title": "Either_int32_or_Either_boolean_or_null", | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Left": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Left" | ||
] | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Right": { | ||
"oneOf": [ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Left": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Left" | ||
] | ||
}, | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Right": { | ||
"type": "null" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Right" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"Right" | ||
] | ||
} | ||
] | ||
} |