proptest-semver

Crates.ioproptest-semver
lib.rsproptest-semver
version0.1.2
created_at2025-03-03 02:31:41.907136+00
updated_at2025-03-07 02:48:29.827763+00
descriptionProperty Testing implementations for Semantic Versioning
homepagehttps://github.com/canardleteer/proptest-semver
repositoryhttps://github.com/canardleteer/proptest-semver
max_upload_size
id1575052
size57,665
dylan (canardleteer)

documentation

README

proptest-semver

Property Testing implementations for Semantic Versioning

Crates.io License Build Status

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 to parse() a semver 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.

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
Commit count: 11

cargo fmt