about summary refs log tree commit diff
path: root/tests/coverage/unicode.coverage
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2023-12-15 14:12:46 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-01-08 21:58:46 +1100
commit6971e9332d9a7fb1567a6df0f30d03452f505ed3 (patch)
tree4700b8dd8e4d714594712fb4eb4732452a51cd66 /tests/coverage/unicode.coverage
parent88f5759ace32abed2bd3dd81ee2aa15d6878675c (diff)
downloadrust-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.coverage40
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|     33|    for _İ in 'А'..='Я' { /* Я */ }
+                      ^32                ^32
+   LL|       |
+   LL|      1|    if 申し訳ございません() && 申し訳ございません() {
+                                                      ^0
+   LL|      0|        println!("true");
+   LL|      1|    }
+   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|      1|        fn $名 () $体 fn 他 () {}
+                                      ^0
+   LL|       |    }
+   LL|       |}
+   LL|       |
+   LL|       |macro_that_defines_a_function! {
+   LL|       |    fn サビ() {}
+   LL|       |}
+