4 releases
new 0.1.2 | Mar 7, 2025 |
---|---|
0.1.1 | Mar 3, 2025 |
0.1.0 | Mar 3, 2025 |
#363 in Testing
518 downloads per month
26KB
288 lines
proptest-semver
Property Testing implementations for Semantic Versioning
This crate is generally meant for doing property testing on Semantic Versioning 2.0.0. While working on sem-tool, I found I needed to add "way too much" for property testing, so broke out this crate instead.
While we can generally generate String
to be parsed, we also take advantage of
the semver crate, as that's a common choice
for Rust developers, and provide support for it. In particular, we support
generation of valid String for
semver::VersionReq
(as well as sub-components).
Notes
- I've never made a "pure testing" crate before, new territory of patterns for me.
- Usage is going to drive this to be a bit better. There's still some non-uniformity in this early release.
Opinions
- I have found situations where the API method for creating
semver::VersionReq
is divergent from the String Parsing route, so I offer both routes of creation.arb_*_semver_*
patterned functions will take a "pure"semver
creation approach.- This is probably faster, but offers less control.
- All other functions, will usually generate
String
, and attempt toparse()
asemver
object out of it.- My use case drove this first, so it's got better handles for probability.
- I expect most use cases take the
parse()
route.
Usage
- Nothing much here yet, recommend looking at tests/main.rs.
- And eventual integration in
sem-tool
.
- And eventual integration in
TODO
- Pull all optional args up to the top.
- Avoid
prop_compose!
for public methods. -
release-plz
pipeline - binary to generate data
- remove misc default weights as magic numbers
- tease apart private api tests from public api tests
Dependencies
~3MB
~58K SLoC