Skip to content

Commit

Permalink
Pattern::spread_into_star noop fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jul 29, 2024
1 parent 7cddf6f commit 65ceeb3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/turbopack-core/src/resolve/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ impl Pattern {
result.normalize();
result
} else {
self.clone()
Pattern::Constant(template.into())
}
}

Expand Down Expand Up @@ -1724,6 +1724,12 @@ mod tests {

#[test]
fn spread_into_star() {
let pat = Pattern::Constant("xyz".into());
assert_eq!(
pat.spread_into_star("before/after"),
Pattern::Constant("before/after".into()),
);

let pat =
Pattern::Concatenation(vec![Pattern::Constant("a/b/c/".into()), Pattern::Dynamic]);
assert_eq!(
Expand Down Expand Up @@ -1766,6 +1772,7 @@ mod tests {
Pattern::Constant("before/b/b".into()),
])
);

let pat = Pattern::Dynamic;
assert_eq!(
pat.spread_into_star("before/*/*"),
Expand Down

0 comments on commit 65ceeb3

Please sign in to comment.