Skip to content

Commit a1d76d4

Browse files
Add tests for no-hidden-lines codeblock attribute
1 parent ab7750c commit a1d76d4

3 files changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<code><span class="macro">macro_rules! </span>test {
2+
(#a,##b,###c) =&gt; {}
3+
}
4+
5+
<span class="macro">test!</span>(
6+
#a,
7+
#b,
8+
##c
9+
);</code>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<code><span class="macro">macro_rules! </span>test {
2+
(#a,##b,###c) =&gt; {}
3+
}
4+
5+
<span class="macro">test!</span>(
6+
#a,
7+
##b,
8+
###c
9+
);</code>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Test that the `no_hidden_lines` codeblock attribute prevents lines starting with `#` to
2+
// be stripped.
3+
4+
#![crate_name = "foo"]
5+
6+
// @has 'foo/index.html'
7+
// @matches - '//*[@class="rust rust-example-rendered"]/code' '\(\s+#a,\s+##b,\s+###c\s+\);'
8+
// @snapshot 'codeblock' - '//*[@class="rust rust-example-rendered"]/code'
9+
10+
//! ```rust,no_hidden_lines
11+
//! macro_rules! test {
12+
//! (#a,##b,###c) => {}
13+
//! }
14+
//!
15+
//! test!(
16+
//! #a,
17+
//! ##b,
18+
//! ###c
19+
//! );
20+
//! ```
21+
22+
// @has 'foo/fn.foo.html'
23+
// @matches - '//*[@class="rust rust-example-rendered"]/code' '\(\s+#a,\s+#b,\s+##c\s+\);'
24+
// @snapshot 'codeblock-non-raw' - '//*[@class="rust rust-example-rendered"]/code'
25+
26+
/// ```
27+
/// macro_rules! test {
28+
/// (#a,##b,###c) => {}
29+
/// }
30+
///
31+
/// test!(
32+
/// #a,
33+
/// ##b,
34+
/// ###c
35+
/// );
36+
/// ```
37+
pub fn foo() {}
38+
39+
// Testing that `raw` means that it is a rust code block by default.
40+
// @has 'foo/fn.bar.html'
41+
// @matches - '//*[@class="rust rust-example-rendered"]/code' '\(\s+#a,\s+##b,\s+###c\s+\);'
42+
43+
/// ```no_hidden_lines
44+
/// macro_rules! test {
45+
/// (#a,##b,###c) => {}
46+
/// }
47+
///
48+
/// test!(
49+
/// #a,
50+
/// ##b,
51+
/// ###c
52+
/// );
53+
/// ```
54+
pub fn bar() {}

0 commit comments

Comments
 (0)