Start using rstest
This commit is contained in:
parent
0d69aa81c1
commit
638139b7da
@ -8,3 +8,6 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
arbitrary = "1.2.0"
|
arbitrary = "1.2.0"
|
||||||
proptest = "1.0.0"
|
proptest = "1.0.0"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
rstest = "0.16.0"
|
||||||
|
@ -7,6 +7,8 @@ use parser_combinator::Representation;
|
|||||||
|
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
|
|
||||||
|
use rstest::*;
|
||||||
|
|
||||||
proptest! {
|
proptest! {
|
||||||
#[test]
|
#[test]
|
||||||
fn doesnt_crash(s in "\\PC*") {
|
fn doesnt_crash(s in "\\PC*") {
|
||||||
@ -237,12 +239,13 @@ fn parse_json_document() {
|
|||||||
assert!(parsed_json.is_ok());
|
assert!(parsed_json.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[rstest]
|
||||||
fn test_representations() {
|
#[case(json_null().representation(), Representation::new("null"))]
|
||||||
assert_eq!(json_null().representation(), Representation::new("null"));
|
#[case(json_bool().representation(), Representation::new("true | false"))]
|
||||||
assert_eq!(
|
#[case(json_number().representation(), Representation::new("- | ε (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | )+ . (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | )+ | ε | . (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | )+"))]
|
||||||
json_bool().representation(),
|
fn representations_test(
|
||||||
Representation::new("true | false")
|
#[case] parser_representation: Representation,
|
||||||
);
|
#[case] expected: Representation,
|
||||||
assert_eq!(json_number().representation(), Representation::new("- | ε (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | )+ . (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | )+ | ε | . (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | )+"));
|
) {
|
||||||
|
assert_eq!(parser_representation, expected);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user