Skip to content

Commit

Permalink
Add test for parse_without_dos
Browse files Browse the repository at this point in the history
  • Loading branch information
kkent030315 committed Oct 27, 2024
1 parent 8b3757e commit f8b390f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/pe/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,18 @@ mod tests {
println!("header: {:?}", &header);
}

#[test]
fn parse_without_dos() {
let header = Header::parse_without_dos(&BORLAND_PE32_VALID_NO_RICH_HEADER).unwrap();
assert_eq!(header.dos_stub, DosStub::default());
assert_eq!(header.rich_header.is_none(), true);

// DOS stub is default but rich parser still works
let header = Header::parse_without_dos(&CORRECT_RICH_HEADER).unwrap();
assert_eq!(header.dos_stub, DosStub::default());
assert_eq!(header.rich_header.is_some(), true);
}

#[test]
fn parse_borland_weird_dos_stub() {
let dos_stub = DosStub::parse(&BORLAND_PE32_VALID_NO_RICH_HEADER, 0x200).unwrap();
Expand Down

0 comments on commit f8b390f

Please sign in to comment.