Skip to content

Commit

Permalink
Add Arbitrary to Glob
Browse files Browse the repository at this point in the history
Derive `Arbitrary` for `Glob` struct. This feature is optional so the
derive will only take place when the feature is enabled. This feature is
mandatory when using Glob in fuzz testing.

Signed-off-by: William Johnson <wjohnson@whamcloud.com>
  • Loading branch information
johnsonw committed Jan 24, 2024
1 parent 9b42af9 commit 3b62d1a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/globset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bench = false

[dependencies]
aho-corasick = "1.1.1"
arbitrary = { version = "1.3.2", optional = true, features = ["derive"] }
bstr = { version = "1.6.2", default-features = false, features = ["std"] }
log = { version = "0.4.20", optional = true }
serde = { version = "1.0.188", optional = true }
Expand Down
1 change: 1 addition & 0 deletions crates/globset/src/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl MatchStrategy {
/// It cannot be used directly to match file paths, but it can be converted
/// to a regular expression string or a matcher.
#[derive(Clone, Debug, Eq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
pub struct Glob {
glob: String,
re: String,
Expand Down

0 comments on commit 3b62d1a

Please sign in to comment.