Skip to content

Commit 1eb4553

Browse files
committed
more tests
1 parent 51612c2 commit 1eb4553

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pub mod m1 {
2+
pub struct InPubMod;
3+
}
4+
5+
mod m2 {
6+
pub struct InPrivMod;
7+
}
8+
9+
pub use m1::{InPubMod, InPubMod as InPubMod2};
10+
pub use m2::{InPrivMod, InPrivMod as InPrivMod2};

tests/rustdoc-json/path_name.rs

+35-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// and https://github.com/rust-lang/rust/pull/134880#issuecomment-2596386111
55
//
66
// ignore-tidy-linelength
7+
//@ aux-build: defines_and_reexports.rs
8+
extern crate defines_and_reexports;
79

810
mod priv_mod {
911
pub struct InPrivMod;
@@ -36,5 +38,37 @@ pub type U2 = InPubMod2;
3638
//@ is "$.index[*][?(@.name=='U3')].inner.type_alias.type.resolved_path.name" '"pub_mod::InPubMod"'
3739
pub type U3 = InPubMod3;
3840

39-
// Check we only have paths for structs at there origonal path
41+
// Check we only have paths for structs at their original path
4042
//@ ismany "$.paths[*][?(@.crate_id==0 && @.kind=='struct')].path" '["path_name", "priv_mod", "InPrivMod"]' '["path_name", "pub_mod", "InPubMod"]'
43+
44+
pub use defines_and_reexports::{InPrivMod as XPrivMod, InPubMod as XPubMod};
45+
use defines_and_reexports::{InPrivMod as XPrivMod2, InPubMod as XPubMod2};
46+
47+
//@ is "$.index[*][?(@.name=='X0')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::m1::InPubMod"'
48+
pub type X0 = defines_and_reexports::m1::InPubMod;
49+
//@ is "$.index[*][?(@.name=='X1')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPubMod"'
50+
pub type X1 = defines_and_reexports::InPubMod;
51+
//@ is "$.index[*][?(@.name=='X2')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPubMod2"'
52+
pub type X2 = defines_and_reexports::InPubMod2;
53+
//@ is "$.index[*][?(@.name=='X3')].inner.type_alias.type.resolved_path.name" '"XPubMod"'
54+
pub type X3 = XPubMod;
55+
// N.B. This isn't the path as used *or* the original path!
56+
//@ is "$.index[*][?(@.name=='X4')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPubMod"'
57+
pub type X4 = XPubMod2;
58+
59+
//@ is "$.index[*][?(@.name=='Y1')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPrivMod"'
60+
pub type Y1 = defines_and_reexports::InPrivMod;
61+
//@ is "$.index[*][?(@.name=='Y2')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPrivMod2"'
62+
pub type Y2 = defines_and_reexports::InPrivMod2;
63+
//@ is "$.index[*][?(@.name=='Y3')].inner.type_alias.type.resolved_path.name" '"XPrivMod"'
64+
pub type Y3 = XPrivMod;
65+
//@ is "$.index[*][?(@.name=='Y4')].inner.type_alias.type.resolved_path.name" '"defines_and_reexports::InPrivMod"'
66+
pub type Y4 = XPrivMod2;
67+
68+
// For foreign items, $.paths contains the *origional* path, even if it's not publicly
69+
// assessable. This should probably be changed.
70+
71+
//@ has "$.paths[*].path" '["defines_and_reexports", "m1", "InPubMod"]'
72+
//@ has "$.paths[*].path" '["defines_and_reexports", "m2", "InPrivMod"]'
73+
//@ !has "$.paths[*].path" '["defines_and_reexports", "InPubMod"]'
74+
//@ !has "$.paths[*].path" '["defines_and_reexports", "InPrivMod"]'

0 commit comments

Comments
 (0)