proptest-rs / proptest

Hypothesis-like property testing for Rust
Apache License 2.0
1.69k stars 158 forks source link

Add PathBuf Arbitrary impl #362

Closed maackle closed 1 year ago

maackle commented 1 year ago

A minimal implementation of Arbitrary for PathBuf, per #272

sunshowers commented 1 year ago

(author of camino here, including the Arbitrary impl for Utf8PathBuf)

I think a useful impl should have a certain number of components separated by MAIN_SEPARATOR, and should be able to generate relative and absolute paths with 50-50 probability. (And as a stretch goal it could also generate all of the other prefix components on Windows, UNC paths and such)

https://docs.rs/camino/1.1.6/src/camino/proptest_impls.rs.html#14-42

matthew-russo commented 1 year ago

Sorry for the delay in getting to this -- works been busy this week. I'll try to give this a look tonight.

maackle commented 1 year ago

Awesome @sunshowers, that's the kind of the feedback I was hoping for. "The best way to get something done right is to do it wrong on the internet". :)