2 unstable releases

new 0.4.0 Jan 2, 2025
0.3.3 Dec 31, 2024
0.0.0 Dec 31, 2024

#266 in Testing

Download history 295/week @ 2024-12-28

295 downloads per month
Used in rsonpath-lib

MIT license

270KB
5K SLoC

rsonpath-syntax-proptestproptest::Arbitrary implementation for rsonpath-syntax

Rust docs.rs

Crates.io

License

Utilities for property testing with types in rsonpath-syntax.

The crate exposes two types, ArbitraryJsonPathQuery and ArbitraryJsonPathQueryParam. The ArbitraryJsonPathQuery implements proptest::Arbitrary which generates an arbitrary JSONPath query string representation and rsonpath_syntax::JsonPathQuery object.

Usage

This is mostly used for internal testing of rsonpath-lib and rsonpath-syntax, but it is in general useful for property-testing or fuzzing code that relies on JSONPath queries as input.

Example usage with proptest:

use proptest::prelude::*;
use rsonpath_syntax_proptest::ArbitraryJsonPathQuery;

proptest! {
    #[test]
    fn example(ArbitraryJsonPathQuery { parsed, string } in prop::arbitrary::any::<ArbitraryJsonPathQuery>()) {
        // Your test using parsed (JsonPathQuery) and/or string (String).
    }
}

Dependencies

~6MB
~98K SLoC