Skip to content

Commit 2a1595e

Browse files
Add regression test for including extern crates in import filtering
1 parent 7319811 commit 2a1595e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tests/rustdoc-js/import-filter.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This test ensures that when filtering on `import`, `externcrate` items are also displayed.
2+
// It also ensures that the opposite is not true.
3+
4+
const EXPECTED = [
5+
{
6+
'query': 'import:st',
7+
'others': [
8+
{ 'path': 'foo', 'name': 'st', 'href': '../foo/index.html#reexport.st' },
9+
// FIXME: `href` is wrong: <https://github.com/rust-lang/rust/issues/148300>
10+
{ 'path': 'foo', 'name': 'st2', 'href': '../st2/index.html' },
11+
],
12+
},
13+
{
14+
'query': 'externcrate:st',
15+
'others': [
16+
// FIXME: `href` is wrong: <https://github.com/rust-lang/rust/issues/148300>
17+
{ 'path': 'foo', 'name': 'st2', 'href': '../st2/index.html' },
18+
],
19+
},
20+
];

tests/rustdoc-js/import-filter.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![crate_name = "foo"]
2+
3+
pub extern crate std as st2;
4+
5+
pub use crate::Bar as st;
6+
7+
pub struct Bar;

0 commit comments

Comments
 (0)