Skip to content

Commit

Permalink
test: add test that explains the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PrettyWood committed Oct 8, 2024
1 parent 1b12664 commit 21c7f61
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Binary file added tests/no-header.xlsx
Binary file not shown.
26 changes: 26 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2099,3 +2099,29 @@ fn ods_with_annotations() {
let range = ods.worksheet_range("table1").unwrap();
range_eq!(range, [[String("cell a.1".to_string())],]);
}

#[rstest]
#[case(HeaderRow::Row(0), &[
[Empty, Empty],
[Empty, Empty],
[String("a".to_string()), Float(0.0)],
[String("b".to_string()), Float(1.0)]
])]
#[case(HeaderRow::Row(1), &[
[Empty, Empty],
[String("a".to_string()), Float(0.0)],
[String("b".to_string()), Float(1.0)]
])]
#[case(HeaderRow::Row(2), &[
[String("a".to_string()), Float(0.0)],
[String("b".to_string()), Float(1.0)]
])]
fn test_no_header(#[case] header_row: HeaderRow, #[case] expected: &[[Data; 2]]) {
let mut excel: Xlsx<_> = wb("no-header.xlsx");
let range = excel
.with_header_row(header_row)
.worksheet_range_at(0)
.unwrap()
.unwrap();
range_eq!(range, expected);
}

0 comments on commit 21c7f61

Please sign in to comment.