From f8b390f4f217282c184ba54e1a2317ad82ab5226 Mon Sep 17 00:00:00 2001 From: kkent030315 Date: Sun, 27 Oct 2024 18:18:02 +0900 Subject: [PATCH] Add test for `parse_without_dos` --- src/pe/header.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pe/header.rs b/src/pe/header.rs index b6ed7875..8558194d 100644 --- a/src/pe/header.rs +++ b/src/pe/header.rs @@ -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();