1
Fork 0

coverage: Test for column numbers involving non-ASCII characters

This commit is contained in:
Zalathar 2023-12-15 22:41:01 +11:00
parent 0ee9cfd54d
commit 585a285619
2 changed files with 89 additions and 0 deletions

36
tests/coverage/unicode.rs Normal file
View 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 () {}
}