coverage: Test for column numbers involving non-ASCII characters
This commit is contained in:
parent
0ee9cfd54d
commit
585a285619
2 changed files with 89 additions and 0 deletions
53
tests/coverage/unicode.cov-map
Normal file
53
tests/coverage/unicode.cov-map
Normal file
|
@ -0,0 +1,53 @@
|
|||
Function name: unicode::main
|
||||
Raw bytes (67): 0x[01, 01, 09, 01, 05, 03, 05, 1e, 0d, 22, 09, 03, 05, 11, 1b, 1e, 0d, 22, 09, 03, 05, 09, 01, 0e, 01, 00, 0b, 05, 01, 09, 00, 0b, 03, 00, 0f, 00, 18, 05, 00, 19, 00, 24, 22, 02, 08, 00, 13, 09, 00, 17, 00, 22, 11, 00, 23, 02, 06, 1b, 02, 06, 00, 07, 17, 02, 05, 01, 02]
|
||||
Number of files: 1
|
||||
- file 0 => global file 1
|
||||
Number of expressions: 9
|
||||
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
|
||||
- expression 1 operands: lhs = Expression(0, Add), rhs = Counter(1)
|
||||
- expression 2 operands: lhs = Expression(7, Sub), rhs = Counter(3)
|
||||
- expression 3 operands: lhs = Expression(8, Sub), rhs = Counter(2)
|
||||
- expression 4 operands: lhs = Expression(0, Add), rhs = Counter(1)
|
||||
- expression 5 operands: lhs = Counter(4), rhs = Expression(6, Add)
|
||||
- expression 6 operands: lhs = Expression(7, Sub), rhs = Counter(3)
|
||||
- expression 7 operands: lhs = Expression(8, Sub), rhs = Counter(2)
|
||||
- expression 8 operands: lhs = Expression(0, Add), rhs = Counter(1)
|
||||
Number of file 0 mappings: 9
|
||||
- Code(Counter(0)) at (prev + 14, 1) to (start + 0, 11)
|
||||
- Code(Counter(1)) at (prev + 1, 9) to (start + 0, 11)
|
||||
- Code(Expression(0, Add)) at (prev + 0, 15) to (start + 0, 24)
|
||||
= (c0 + c1)
|
||||
- Code(Counter(1)) at (prev + 0, 25) to (start + 0, 36)
|
||||
- Code(Expression(8, Sub)) at (prev + 2, 8) to (start + 0, 19)
|
||||
= ((c0 + c1) - c1)
|
||||
- Code(Counter(2)) at (prev + 0, 23) to (start + 0, 34)
|
||||
- Code(Counter(4)) at (prev + 0, 35) to (start + 2, 6)
|
||||
- Code(Expression(6, Add)) at (prev + 2, 6) to (start + 0, 7)
|
||||
= ((((c0 + c1) - c1) - c2) + c3)
|
||||
- Code(Expression(5, Add)) at (prev + 2, 5) to (start + 1, 2)
|
||||
= (c4 + ((((c0 + c1) - c1) - c2) + c3))
|
||||
|
||||
Function name: unicode::サビ
|
||||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 1e, 12, 00, 14]
|
||||
Number of files: 1
|
||||
- file 0 => global file 1
|
||||
Number of expressions: 0
|
||||
Number of file 0 mappings: 1
|
||||
- Code(Counter(0)) at (prev + 30, 18) to (start + 0, 20)
|
||||
|
||||
Function name: unicode::他 (unused)
|
||||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 1e, 15, 00, 1f]
|
||||
Number of files: 1
|
||||
- file 0 => global file 1
|
||||
Number of expressions: 0
|
||||
Number of file 0 mappings: 1
|
||||
- Code(Zero) at (prev + 30, 21) to (start + 0, 31)
|
||||
|
||||
Function name: unicode::申し訳ございません
|
||||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 18, 01, 02, 02]
|
||||
Number of files: 1
|
||||
- file 0 => global file 1
|
||||
Number of expressions: 0
|
||||
Number of file 0 mappings: 1
|
||||
- Code(Counter(0)) at (prev + 24, 1) to (start + 2, 2)
|
||||
|
36
tests/coverage/unicode.rs
Normal file
36
tests/coverage/unicode.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
// edition: 2021
|
||||
// ignore-mode-coverage-run - `llvm-cov` fails due to incorrectly-split UTF-8
|
||||
// llvm-cov-flags: --use-color
|
||||
|
||||
// Check that column numbers are denoted in bytes, so that they don't cause
|
||||
// `llvm-cov` to fail or emit malformed output.
|
||||
//
|
||||
// Note that when `llvm-cov` prints ^ arrows on a subsequent line, it simply
|
||||
// inserts one space character for each "column", with no understanding of
|
||||
// Unicode or character widths. So those arrows will tend to be misaligned
|
||||
// for non-ASCII source code, regardless of whether column numbers are code
|
||||
// points or bytes.
|
||||
|
||||
fn main() {
|
||||
for _İ in 'А'..='Я' { /* Я */ }
|
||||
|
||||
if 申し訳ございません() && 申し訳ございません() {
|
||||
println!("true");
|
||||
}
|
||||
|
||||
サビ();
|
||||
}
|
||||
|
||||
fn 申し訳ございません() -> bool {
|
||||
std::hint::black_box(false)
|
||||
}
|
||||
|
||||
macro_rules! macro_that_defines_a_function {
|
||||
(fn $名:ident () $体:tt) => {
|
||||
fn $名 () $体 fn 他 () {}
|
||||
}
|
||||
}
|
||||
|
||||
macro_that_defines_a_function! {
|
||||
fn サビ() {}
|
||||
}
|
Loading…
Add table
Reference in a new issue