BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.4k stars 149 forks source link

Arbitrary for PathBuf and OsString #168

Closed droundy closed 6 years ago

droundy commented 7 years ago

Hello, I just implemented hopefully a reasonable Arbitrary for PathBuf (and incidentally OsString). The PathBuf arbitrary tries to get somewhat interesting and/or realistic paths, but doesn't try to hard (e.g. it will *extremely** rarely pick a path like foo/../bar. But it does get realistic prefixes (hopefully), and shouldn't do anything too insane.

I also added *~ to gitignore.

sdleffler commented 6 years ago

I could really use this. Perhaps as a start to shrinking PathBuf, it could be .pop()'d and the .pop()'d path could be added to the shrinker if .pop() returned true?

BurntSushi commented 6 years ago

I addressed my feedback, squashed this down to one commit and merged it here: https://github.com/BurntSushi/quickcheck/commit/af95aabd9af57b3de6aed2067118cb1df9fc941b