Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 13335e3

Browse files
committedMar 21, 2025
tests/rustdoc-json: change assertions to use RFC 9535 jsonpath
1 parent 42631d8 commit 13335e3

10 files changed

+25
-25
lines changed
 

‎tests/rustdoc-json/enums/use_variant_foreign.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
extern crate color;
44

5-
//@ has "$.index[*].inner.use[?(@.name == 'Red')]"
5+
//@ has "$.index[?(@.inner.use.name == 'Red')]"
66
pub use color::Color::Red;
77

88
//@ !has "$.index[?(@.name == 'Red')]"

‎tests/rustdoc-json/primitives/use_primitive.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod usize {}
1313
//@ !is "$.index[?(@.name=='checked_add')]" $local_crate_id
1414
//@ !has "$.index[?(@.name=='is_ascii_uppercase')]"
1515

16-
//@ is "$.index[*].inner.use[?(@.name=='my_i32')].id" null
16+
//@ is "$.index[?(@.inner.use.name=='my_i32')].inner.use.id" null
1717
pub use i32 as my_i32;
18-
//@ is "$.index[*].inner.use[?(@.name=='u32')].id" null
18+
//@ is "$.index[?(@.inner.use.name=='u32')].inner.use.id" null
1919
pub use u32;

‎tests/rustdoc-json/reexport/glob_collision.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ mod m2 {
1414
}
1515

1616
//@ set m1_use = "$.index[?(@.docs=='m1 re-export')].id"
17-
//@ is "$.index[*].inner.use[?(@.name=='m1')].id" $m1
18-
//@ is "$.index[*].inner.use[?(@.name=='m1')].is_glob" true
17+
//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.id" $m1
18+
//@ is "$.index[?(@.inner.use.name=='m1')].inner.use.is_glob" true
1919
/// m1 re-export
2020
pub use m1::*;
2121
//@ set m2_use = "$.index[?(@.docs=='m2 re-export')].id"
22-
//@ is "$.index[*].inner.use[?(@.name=='m2')].id" $m2
23-
//@ is "$.index[*].inner.use[?(@.name=='m2')].is_glob" true
22+
//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.id" $m2
23+
//@ is "$.index[?(@.inner.use.name=='m2')].inner.use.is_glob" true
2424
/// m2 re-export
2525
pub use m2::*;
2626

27-
//@ ismany "$.index[*].inner.module[?(@.is_crate==true)].items[*]" $m1_use $m2_use
27+
//@ ismany "$.index[?(@.name=='glob_collision')].inner.module.items[*]" $m1_use $m2_use
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//@ !has "$.index[?(@.name=='foo')]"
1+
//@ !has "$.index[*].name" '"foo"'
22
mod foo {
3-
//@ has "$.index[?(@.name=='Foo')]"
3+
//@ has "$.index[*].name" '"Foo"'
44
pub struct Foo;
55
}
66

7-
//@ has "$.index[*].inner[?(@.use.source=='foo::Foo')]"
7+
//@ has "$.index[*].inner.use.source" '"foo::Foo"'
88
pub use foo::Foo;
99

1010
pub mod bar {
11-
//@ has "$.index[*].inner[?(@.use.source=='crate::foo::Foo')]"
11+
//@ has "$.index[*].inner.use.source" '"crate::foo::Foo"'
1212
pub use crate::foo::Foo;
1313
}

‎tests/rustdoc-json/reexport/in_root_and_mod_pub.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ pub mod foo {
55
}
66

77
//@ set root_import_id = "$.index[?(@.docs=='Outer re-export')].id"
8-
//@ is "$.index[*].inner[?(@.use.source=='foo::Bar')].use.id" $bar_id
8+
//@ is "$.index[?(@.inner.use.source=='foo::Bar')].inner.use.id" $bar_id
99
//@ has "$.index[?(@.name=='in_root_and_mod_pub')].inner.module.items[*]" $root_import_id
1010
/// Outer re-export
1111
pub use foo::Bar;
1212

1313
pub mod baz {
1414
//@ set baz_import_id = "$.index[?(@.docs=='Inner re-export')].id"
15-
//@ is "$.index[*].inner[?(@.use.source=='crate::foo::Bar')].use.id" $bar_id
15+
//@ is "$.index[?(@.inner.use.source=='crate::foo::Bar')].inner.use.id" $bar_id
1616
//@ ismany "$.index[?(@.name=='baz')].inner.module.items[*]" $baz_import_id
1717
/// Inner re-export
1818
pub use crate::foo::Bar;

‎tests/rustdoc-json/reexport/mod_not_included.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ mod m1 {
77
pub use m1::x;
88

99
//@ has "$.index[?(@.name=='x' && @.inner.function)]"
10-
//@ has "$.index[*].inner[?(@.use.name=='x')].use.source" '"m1::x"'
10+
//@ has "$.index[?(@.inner.use.name=='x')].inner.use.source" '"m1::x"'
1111
//@ !has "$.index[?(@.name=='m1')]"

‎tests/rustdoc-json/reexport/reexport_of_hidden.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ compile-flags: --document-hidden-items
22

3-
//@ has "$.index[*].inner[?(@.use.name=='UsedHidden')]"
4-
//@ has "$.index[?(@.name=='Hidden')]"
3+
//@ has "$.index[*].inner.use.name" '"UsedHidden"'
4+
//@ has "$.index[*].name" '"Hidden"'
55
pub mod submodule {
66
#[doc(hidden)]
77
pub struct Hidden {}

‎tests/rustdoc-json/reexport/rename_public.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ pub mod inner {
77
pub struct Public;
88
}
99
//@ set import_id = "$.index[?(@.docs=='Re-export')].id"
10-
//@ !has "$.index[*].inner[?(@.use.name=='Public')]"
11-
//@ is "$.index[*].inner[?(@.use.name=='NewName')].use.source" \"inner::Public\"
10+
//@ !has "$.index[?(@.inner.use.name=='Public')]"
11+
//@ is "$.index[?(@.inner.use.name=='NewName')].inner.use.source" \"inner::Public\"
1212
/// Re-export
1313
pub use inner::Public as NewName;
1414

‎tests/rustdoc-json/reexport/same_name_different_types.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ pub mod nested {
1313
pub fn Foo() {}
1414
}
1515

16-
//@ ismany "$.index[*].inner[?(@.use.name == 'Foo')].use.id" $foo_fn $foo_struct
17-
//@ ismany "$.index[*].inner[?(@.use.name == 'Bar')].use.id" $foo_fn $foo_struct
16+
//@ ismany "$.index[?(@.inner.use.name == 'Foo')].inner.use.id" $foo_fn $foo_struct
17+
//@ ismany "$.index[?(@.inner.use.name == 'Bar')].inner.use.id" $foo_fn $foo_struct
1818

19-
//@ count "$.index[*].inner[?(@.use.name == 'Foo')]" 2
20-
//@ count "$.index[*].inner[?(@.use.name == 'Bar')]" 2
19+
//@ count "$.index[?(@.inner.use.name == 'Foo')]" 2
20+
//@ count "$.index[?(@.inner.use.name == 'Bar')]" 2
2121
pub use Foo as Bar;
2222
pub use nested::Foo;

‎tests/rustdoc-json/reexport/same_type_reexported_more_than_once.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ mod inner {
88
}
99

1010
//@ set export_id = "$.index[?(@.docs=='First re-export')].id"
11-
//@ is "$.index[*].inner[?(@.use.name=='Trait')].use.id" $trait_id
11+
//@ is "$.index[?(@.inner.use.name=='Trait')].inner.use.id" $trait_id
1212
/// First re-export
1313
pub use inner::Trait;
1414
//@ set reexport_id = "$.index[?(@.docs=='Second re-export')].id"
15-
//@ is "$.index[*].inner[?(@.use.name=='Reexport')].use.id" $trait_id
15+
//@ is "$.index[?(@.inner.use.name=='Reexport')].inner.use.id" $trait_id
1616
/// Second re-export
1717
pub use inner::Trait as Reexport;
1818

0 commit comments

Comments
 (0)
Failed to load comments.