Skip to content

Commit

Permalink
Adds test for comments in linker script.
Browse files Browse the repository at this point in the history
  • Loading branch information
BriocheBerlin committed Nov 1, 2023
1 parent 468bbbf commit d4098b3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,31 @@ mod tests {
);
}

#[test]
fn parse_comment() {
const LINKER_SCRIPT: &str = "MEMORY
{
FLASH : ORIGIN = 0x00000000, LENGTH = 256K
RAM : ORIGIN = 0x20000000, LENGTH = 64K /* This is a comment */
}
INCLUDE device.x";

assert_eq!(
find_ram_in_linker_script(LINKER_SCRIPT),
Some(MemoryEntry {
line: 3,
origin: 0x20000000,
length: 64 * 1024,
})
);

assert_eq!(
get_includes_from_linker_script(LINKER_SCRIPT),
vec!["device.x"]
);
}

#[test]
fn test_perform_addition_hex_and_number() {
const ADDITION: &str = "0x20000000 + 1000";
Expand Down

0 comments on commit d4098b3

Please sign in to comment.