diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2021-07-24 16:08:27 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2021-08-06 15:27:22 +0200 |
| commit | ee3811671b8f4b7e6d1498a408182e2586d22613 (patch) | |
| tree | 83be26f621f326f00c5d30674d03d7a768af1b8e | |
| parent | 47c50560146fb8deebb3410765f66be4dc87cf81 (diff) | |
| download | rust-ee3811671b8f4b7e6d1498a408182e2586d22613.tar.gz rust-ee3811671b8f4b7e6d1498a408182e2586d22613.zip | |
Add test for union keyword highlighting
| -rw-r--r-- | src/librustdoc/html/highlight/fixtures/union.html | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/highlight/fixtures/union.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/highlight/tests.rs | 10 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/librustdoc/html/highlight/fixtures/union.html b/src/librustdoc/html/highlight/fixtures/union.html new file mode 100644 index 00000000000..c0acf31a05d --- /dev/null +++ b/src/librustdoc/html/highlight/fixtures/union.html @@ -0,0 +1,8 @@ +<span class="kw">union</span> <span class="ident">Foo</span> { + <span class="ident">i</span>: <span class="ident">i8</span>, + <span class="ident">u</span>: <span class="ident">i8</span>, +} + +<span class="kw">fn</span> <span class="ident">main</span>() { + <span class="kw">let</span> <span class="ident">union</span> <span class="op">=</span> <span class="number">0</span>; +} diff --git a/src/librustdoc/html/highlight/fixtures/union.rs b/src/librustdoc/html/highlight/fixtures/union.rs new file mode 100644 index 00000000000..269ee115d3f --- /dev/null +++ b/src/librustdoc/html/highlight/fixtures/union.rs @@ -0,0 +1,8 @@ +union Foo { + i: i8, + u: i8, +} + +fn main() { + let union = 0; +} diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs index 68592ae96c1..450bbfea1ea 100644 --- a/src/librustdoc/html/highlight/tests.rs +++ b/src/librustdoc/html/highlight/tests.rs @@ -54,3 +54,13 @@ let y = Self::whatever;"; expect_file!["fixtures/highlight.html"].assert_eq(&html.into_inner()); }); } + +#[test] +fn test_union_highlighting() { + create_default_session_globals_then(|| { + let src = include_str!("fixtures/union.rs"); + let mut html = Buffer::new(); + write_code(&mut html, src, Edition::Edition2018, None); + expect_file!["fixtures/union.html"].assert_eq(&html.into_inner()); + }); +} |
