Skip to content

Commit ee38116

Browse files
Add test for union keyword highlighting
1 parent 47c5056 commit ee38116

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<span class="kw">union</span> <span class="ident">Foo</span> {
2+
<span class="ident">i</span>: <span class="ident">i8</span>,
3+
<span class="ident">u</span>: <span class="ident">i8</span>,
4+
}
5+
6+
<span class="kw">fn</span> <span class="ident">main</span>() {
7+
<span class="kw">let</span> <span class="ident">union</span> <span class="op">=</span> <span class="number">0</span>;
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
union Foo {
2+
i: i8,
3+
u: i8,
4+
}
5+
6+
fn main() {
7+
let union = 0;
8+
}

src/librustdoc/html/highlight/tests.rs

+10
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,13 @@ let y = Self::whatever;";
5454
expect_file!["fixtures/highlight.html"].assert_eq(&html.into_inner());
5555
});
5656
}
57+
58+
#[test]
59+
fn test_union_highlighting() {
60+
create_default_session_globals_then(|| {
61+
let src = include_str!("fixtures/union.rs");
62+
let mut html = Buffer::new();
63+
write_code(&mut html, src, Edition::Edition2018, None);
64+
expect_file!["fixtures/union.html"].assert_eq(&html.into_inner());
65+
});
66+
}

0 commit comments

Comments
 (0)