about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2022-08-20 14:24:05 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2022-08-20 14:24:05 +0200
commit7ab8e0cbe4c6e7617fe43a44467c463fad3b010e (patch)
tree9495261da8ad41a6163cd6df13ef2a64a74e192e /src
parent4c89c2886d9d915db3e11a9f87a188cada9dd457 (diff)
downloadrust-7ab8e0cbe4c6e7617fe43a44467c463fad3b010e.tar.gz
rust-7ab8e0cbe4c6e7617fe43a44467c463fad3b010e.zip
Extend decoration test to detect regressions
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/highlight/fixtures/decorations.html4
-rw-r--r--src/librustdoc/html/highlight/tests.rs7
2 files changed, 8 insertions, 3 deletions
diff --git a/src/librustdoc/html/highlight/fixtures/decorations.html b/src/librustdoc/html/highlight/fixtures/decorations.html
index f73e7c1fe76..ebf29f9cb3a 100644
--- a/src/librustdoc/html/highlight/fixtures/decorations.html
+++ b/src/librustdoc/html/highlight/fixtures/decorations.html
@@ -1,2 +1,4 @@
 <span class="example"><span class="kw">let </span>x = <span class="number">1</span>;
-</span><span class="kw">let </span>y = <span class="number">2</span>;
\ No newline at end of file
+<span class="kw">let </span>y = <span class="number">2</span>;
+</span><span class="example2"><span class="kw">let </span>z = <span class="number">3</span>;
+</span><span class="kw">let </span>a = <span class="number">4</span>;
\ No newline at end of file
diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs
index 4861a8ad32d..a5e633df434 100644
--- a/src/librustdoc/html/highlight/tests.rs
+++ b/src/librustdoc/html/highlight/tests.rs
@@ -69,9 +69,12 @@ fn test_union_highlighting() {
 fn test_decorations() {
     create_default_session_globals_then(|| {
         let src = "let x = 1;
-let y = 2;";
+let y = 2;
+let z = 3;
+let a = 4;";
         let mut decorations = FxHashMap::default();
-        decorations.insert("example", vec![(0, 10)]);
+        decorations.insert("example", vec![(0, 10), (11, 21)]);
+        decorations.insert("example2", vec![(22, 32)]);
 
         let mut html = Buffer::new();
         write_code(&mut html, src, None, Some(DecorationInfo(decorations)));