Skip to content

Commit

Permalink
chore: add roundtrip test for StaticFileSegment filename (#13381)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo authored Dec 13, 2024
1 parent 8c7d399 commit a69abd4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/static-file/types/src/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ impl From<SegmentRangeInclusive> for RangeInclusive<u64> {
#[cfg(test)]
mod tests {
use super::*;
use strum::IntoEnumIterator;

#[test]
fn test_filename() {
Expand Down Expand Up @@ -401,5 +402,12 @@ mod tests {

assert_eq!(StaticFileSegment::parse_filename("static_file_headers_2"), None);
assert_eq!(StaticFileSegment::parse_filename("static_file_headers_"), None);

// roundtrip test
let dummy_range = SegmentRangeInclusive::new(123, 1230);
for segment in StaticFileSegment::iter() {
let filename = segment.filename(&dummy_range);
assert_eq!(Some((segment, dummy_range)), StaticFileSegment::parse_filename(&filename));
}
}
}

0 comments on commit a69abd4

Please sign in to comment.