diff --git a/crates/typos-cli/tests/cmd/false-positives.in/sample.cpp b/crates/typos-cli/tests/cmd/false-positives.in/sample.cpp index 40455b15..7cd246b9 100644 --- a/crates/typos-cli/tests/cmd/false-positives.in/sample.cpp +++ b/crates/typos-cli/tests/cmd/false-positives.in/sample.cpp @@ -1,5 +1,5 @@ int main() { - uint8 i = 0; + uint8 i = 0x1afe23456UL; std::countr_one(i); return 0; } diff --git a/crates/typos-cli/tests/cmd/false-positives.toml b/crates/typos-cli/tests/cmd/false-positives.toml index 324f41d7..276faf9a 100644 --- a/crates/typos-cli/tests/cmd/false-positives.toml +++ b/crates/typos-cli/tests/cmd/false-positives.toml @@ -1,4 +1,11 @@ bin.name = "typos" stdin = "" -stdout = "" +stdout = """ +error: `afe` should be `safe` + ╭▸ ./sample.cpp:2:18 + │ +2 │ uint8 i = 0x1afe23456UL; + ╰╴ ━━━ +""" stderr = "" +status.code = 2 diff --git a/crates/typos/src/tokens.rs b/crates/typos/src/tokens.rs index 43213112..dc368f57 100644 --- a/crates/typos/src/tokens.rs +++ b/crates/typos/src/tokens.rs @@ -1260,7 +1260,7 @@ mod test { fn tokenize_ignore_hex() { let parser = TokenizerBuilder::new().build(); - let input = "Hello 0xDEADBEEF World"; + let input = "Hello 0xDEADBEEF 0x1afe23456UL World"; let actual: Vec<_> = parser.parse_bytes(input.as_bytes()).collect(); assert_data_eq!( actual.to_debug(), @@ -1272,10 +1272,15 @@ mod test { offset: 0, }, Identifier { - token: "World", + token: "0x1afe23456UL", case: None, offset: 17, }, + Identifier { + token: "World", + case: None, + offset: 31, + }, ] "#]] @@ -1291,10 +1296,15 @@ mod test { offset: 0, }, Identifier { - token: "World", + token: "0x1afe23456UL", case: None, offset: 17, }, + Identifier { + token: "World", + case: None, + offset: 31, + }, ] "#]]