Skip to content

Commit

Permalink
Extend decoration test to detect regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Aug 20, 2022
1 parent 4c89c28 commit 7ab8e0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/librustdoc/html/highlight/fixtures/decorations.html
Original file line number Diff line number Diff line change
@@ -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>;
<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>;
7 changes: 5 additions & 2 deletions src/librustdoc/html/highlight/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down

0 comments on commit 7ab8e0c

Please sign in to comment.