diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2023-12-15 14:12:46 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-01-08 21:58:46 +1100 |
| commit | 6971e9332d9a7fb1567a6df0f30d03452f505ed3 (patch) | |
| tree | 4700b8dd8e4d714594712fb4eb4732452a51cd66 /tests/coverage/unicode.coverage | |
| parent | 88f5759ace32abed2bd3dd81ee2aa15d6878675c (diff) | |
| download | rust-6971e9332d9a7fb1567a6df0f30d03452f505ed3.tar.gz rust-6971e9332d9a7fb1567a6df0f30d03452f505ed3.zip | |
coverage: `llvm-cov` expects column numbers to be bytes, not code points
Diffstat (limited to 'tests/coverage/unicode.coverage')
| -rw-r--r-- | tests/coverage/unicode.coverage | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/coverage/unicode.coverage b/tests/coverage/unicode.coverage new file mode 100644 index 00000000000..b284a557d57 --- /dev/null +++ b/tests/coverage/unicode.coverage @@ -0,0 +1,40 @@ + LL| |// edition: 2021 + LL| |// ignore-windows - we can't force `llvm-cov` to use ANSI escapes on Windows + LL| |// llvm-cov-flags: --use-color + LL| | + LL| |// Check that column numbers are denoted in bytes, so that they don't cause + LL| |// `llvm-cov` to fail or emit malformed output. + LL| |// + LL| |// Note that when `llvm-cov` prints ^ arrows on a subsequent line, it simply + LL| |// inserts one space character for each "column", with no understanding of + LL| |// Unicode or character widths. So those arrows will tend to be misaligned + LL| |// for non-ASCII source code, regardless of whether column numbers are code + LL| |// points or bytes. + LL| | + LL| 1|fn main() { + LL| [0;35m33[0m| for _İ in 'А'..='Я' { /* Я */ } + ^32 ^32 + LL| | + LL| [0;35m1[0m| if 申し訳ございません() && [0;41m申し訳ございません()[0m [0;41m{[0m + ^0 + LL| 0|[0;41m println!("true");[0m + LL| 1|[0;41m }[0m + LL| | + LL| 1| サビ(); + LL| 1|} + LL| | + LL| 1|fn 申し訳ございません() -> bool { + LL| 1| std::hint::black_box(false) + LL| 1|} + LL| | + LL| |macro_rules! macro_that_defines_a_function { + LL| | (fn $名:ident () $体:tt) => { + LL| [0;35m1[0m| fn $名 () $体 [0;41mfn 他 () {}[0m + ^0 + LL| | } + LL| |} + LL| | + LL| |macro_that_defines_a_function! { + LL| | fn サビ() {} + LL| |} + |
