Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix constructor call for patttern #484

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cedar-drt/fuzz/fuzz_targets/wildcard-matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fn wildcard_match_regex<'a>(
fuzz_target!(|input: FuzzTargetInput| {
// Ensure wildcard matching is equivalent to the regex version
let regex_result = wildcard_match_regex(&input.string, &input.pattern);
let rust_result = Pattern::new(input.pattern).wildcard_match(&input.string);
let rust_result = Pattern::from(input.pattern).wildcard_match(&input.string);
assert_eq!(
regex_result, rust_result,
"\nregex result: {};rust result:{}.\n",
Expand Down
7 changes: 2 additions & 5 deletions cedar-policy-generators/src/abac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ impl ConstantPool {

/// Produce a RHS of a like operation
/// It's derived from a random string constant in the pool: We perform transformations over it such as adding a char, deleting a char and adding a wildcard star.
pub fn arbitrary_pattern_literal(
&self,
u: &mut Unstructured<'_>,
) -> Result<Vec<ast::PatternElem>> {
pub fn arbitrary_pattern_literal(&self, u: &mut Unstructured<'_>) -> Result<ast::Pattern> {
let matched_string = self.arbitrary_string_constant_bounded(u, MAX_PATTERN_LEN)?;

let mut pattern = Vec::new();
Expand Down Expand Up @@ -246,7 +243,7 @@ impl ConstantPool {
{}
)
}
Ok(pattern)
Ok(ast::Pattern::from(pattern))
}

// Generate a valid IPv4 net representation
Expand Down