diff options
Diffstat (limited to 'tests/rustdoc-js')
34 files changed, 365 insertions, 216 deletions
diff --git a/tests/rustdoc-js/basic.js b/tests/rustdoc-js/basic.js index d99b23468..e186d5108 100644 --- a/tests/rustdoc-js/basic.js +++ b/tests/rustdoc-js/basic.js @@ -1,6 +1,5 @@ -const QUERY = 'Fo'; - const EXPECTED = { + 'query': 'Fo', 'others': [ { 'path': 'basic', 'name': 'Foo' }, ], diff --git a/tests/rustdoc-js/doc-alias-filter-out.js b/tests/rustdoc-js/doc-alias-filter-out.js index 46a089d06..fd25370df 100644 --- a/tests/rustdoc-js/doc-alias-filter-out.js +++ b/tests/rustdoc-js/doc-alias-filter-out.js @@ -1,9 +1,8 @@ // exact-check -const QUERY = 'true'; - const FILTER_CRATE = 'some_other_crate'; const EXPECTED = { + 'query': 'true', 'others': [], }; diff --git a/tests/rustdoc-js/doc-alias-filter.js b/tests/rustdoc-js/doc-alias-filter.js index e06047ba7..1d2dd8b9a 100644 --- a/tests/rustdoc-js/doc-alias-filter.js +++ b/tests/rustdoc-js/doc-alias-filter.js @@ -1,10 +1,9 @@ // exact-check -const QUERY = '"true"'; - const FILTER_CRATE = 'doc_alias_filter'; const EXPECTED = { + 'query': '"true"', 'others': [ { 'path': 'doc_alias_filter', diff --git a/tests/rustdoc-js/doc-alias-whitespace.js b/tests/rustdoc-js/doc-alias-whitespace.js index c9fc0c431..64784b569 100644 --- a/tests/rustdoc-js/doc-alias-whitespace.js +++ b/tests/rustdoc-js/doc-alias-whitespace.js @@ -1,11 +1,8 @@ // exact-check -const QUERY = [ - 'Demon Lord', -]; - const EXPECTED = [ { + 'query': 'Demon Lord', 'others': [ { 'path': 'doc_alias_whitespace', diff --git a/tests/rustdoc-js/doc-alias.js b/tests/rustdoc-js/doc-alias.js index 62c8e7a74..7e4e8a776 100644 --- a/tests/rustdoc-js/doc-alias.js +++ b/tests/rustdoc-js/doc-alias.js @@ -1,31 +1,6 @@ -const QUERY = [ - 'StructItem', - 'StructFieldItem', - 'StructMethodItem', - 'ImplTraitItem', - 'StructImplConstItem', - 'ImplTraitFunction', - 'EnumItem', - 'VariantItem', - 'EnumMethodItem', - 'TypedefItem', - 'TraitItem', - 'TraitTypeItem', - 'AssociatedConstItem', - 'TraitFunctionItem', - 'FunctionItem', - 'ModuleItem', - 'ConstItem', - 'StaticItem', - 'UnionItem', - 'UnionFieldItem', - 'UnionMethodItem', - 'MacroItem', -]; - const EXPECTED = [ { - // StructItem + 'query': 'StructItem', 'others': [ { 'path': 'doc_alias', @@ -37,7 +12,7 @@ const EXPECTED = [ ], }, { - // StructFieldItem + 'query': 'StructFieldItem', 'others': [ { 'path': 'doc_alias::Struct', @@ -49,7 +24,7 @@ const EXPECTED = [ ], }, { - // StructMethodItem + 'query': 'StructMethodItem', 'others': [ { 'path': 'doc_alias::Struct', @@ -61,11 +36,11 @@ const EXPECTED = [ ], }, { - // ImplTraitItem + 'query': 'ImplTraitItem', 'others': [], }, { - // StructImplConstItem + 'query': 'StructImplConstItem', 'others': [ { 'path': 'doc_alias::Struct', @@ -77,7 +52,7 @@ const EXPECTED = [ ], }, { - // ImplTraitFunction + 'query': 'ImplTraitFunction', 'others': [ { 'path': 'doc_alias::Struct', @@ -89,7 +64,7 @@ const EXPECTED = [ ], }, { - // EnumItem + 'query': 'EnumItem', 'others': [ { 'path': 'doc_alias', @@ -101,7 +76,7 @@ const EXPECTED = [ ], }, { - // VariantItem + 'query': 'VariantItem', 'others': [ { 'path': 'doc_alias::Enum', @@ -113,7 +88,7 @@ const EXPECTED = [ ], }, { - // EnumMethodItem + 'query': 'EnumMethodItem', 'others': [ { 'path': 'doc_alias::Enum', @@ -125,7 +100,7 @@ const EXPECTED = [ ], }, { - // TypedefItem + 'query': 'TypedefItem', 'others': [ { 'path': 'doc_alias', @@ -137,7 +112,7 @@ const EXPECTED = [ ], }, { - // TraitItem + 'query': 'TraitItem', 'others': [ { 'path': 'doc_alias', @@ -149,7 +124,7 @@ const EXPECTED = [ ], }, { - // TraitTypeItem + 'query': 'TraitTypeItem', 'others': [ { 'path': 'doc_alias::Trait', @@ -161,7 +136,7 @@ const EXPECTED = [ ], }, { - // AssociatedConstItem + 'query': 'AssociatedConstItem', 'others': [ { 'path': 'doc_alias::Trait', @@ -173,7 +148,7 @@ const EXPECTED = [ ], }, { - // TraitFunctionItem + 'query': 'TraitFunctionItem', 'others': [ { 'path': 'doc_alias::Trait', @@ -185,7 +160,7 @@ const EXPECTED = [ ], }, { - // FunctionItem + 'query': 'FunctionItem', 'others': [ { 'path': 'doc_alias', @@ -197,7 +172,7 @@ const EXPECTED = [ ], }, { - // ModuleItem + 'query': 'ModuleItem', 'others': [ { 'path': 'doc_alias', @@ -209,7 +184,7 @@ const EXPECTED = [ ], }, { - // ConstItem + 'query': 'ConstItem', 'others': [ { 'path': 'doc_alias', @@ -225,7 +200,7 @@ const EXPECTED = [ ], }, { - // StaticItem + 'query': 'StaticItem', 'others': [ { 'path': 'doc_alias', @@ -237,7 +212,7 @@ const EXPECTED = [ ], }, { - // UnionItem + 'query': 'UnionItem', 'others': [ { 'path': 'doc_alias', @@ -255,7 +230,7 @@ const EXPECTED = [ ], }, { - // UnionFieldItem + 'query': 'UnionFieldItem', 'others': [ { 'path': 'doc_alias::Union', @@ -267,7 +242,7 @@ const EXPECTED = [ ], }, { - // UnionMethodItem + 'query': 'UnionMethodItem', 'others': [ { 'path': 'doc_alias::Union', @@ -279,7 +254,7 @@ const EXPECTED = [ ], }, { - // MacroItem + 'query': 'MacroItem', 'others': [ { 'path': 'doc_alias', diff --git a/tests/rustdoc-js/exact-match.js b/tests/rustdoc-js/exact-match.js index b0a411bee..ce3a76f9b 100644 --- a/tests/rustdoc-js/exact-match.js +++ b/tests/rustdoc-js/exact-match.js @@ -1,6 +1,5 @@ -const QUERY = 'si::pc'; - const EXPECTED = { + 'query': 'si::pc', 'others': [ { 'path': 'exact_match::Si', 'name': 'pc' }, { 'path': 'exact_match::Psi', 'name': 'pc' }, diff --git a/tests/rustdoc-js/foreign-type-path.js b/tests/rustdoc-js/foreign-type-path.js index 334761bad..b11123d3e 100644 --- a/tests/rustdoc-js/foreign-type-path.js +++ b/tests/rustdoc-js/foreign-type-path.js @@ -1,6 +1,5 @@ -const QUERY = 'MyForeignType::my_method'; - const EXPECTED = { + 'query': 'MyForeignType::my_method', 'others': [ // Test case for https://github.com/rust-lang/rust/pull/96887#pullrequestreview-967154358 // Validates that the parent path for a foreign type method is correct. diff --git a/tests/rustdoc-js/generics-impl.js b/tests/rustdoc-js/generics-impl.js index 5051743bd..5e33e2248 100644 --- a/tests/rustdoc-js/generics-impl.js +++ b/tests/rustdoc-js/generics-impl.js @@ -1,68 +1,56 @@ // exact-check -const QUERY = [ - 'Aaaaaaa -> u32', - 'Aaaaaaa -> bool', - 'Aaaaaaa -> usize', - 'Read -> u64', - 'trait:Read -> u64', - 'struct:Read -> u64', - 'bool -> u64', - 'Ddddddd -> u64', - '-> Ddddddd' -]; - const EXPECTED = [ { - // Aaaaaaa -> u32 + 'query': 'Aaaaaaa -> u32', 'others': [ { 'path': 'generics_impl::Aaaaaaa', 'name': 'bbbbbbb' }, ], }, { - // Aaaaaaa -> bool + 'query': 'Aaaaaaa -> bool', 'others': [ { 'path': 'generics_impl::Aaaaaaa', 'name': 'ccccccc' }, ], }, { - // Aaaaaaa -> usize + 'query': 'Aaaaaaa -> usize', 'others': [ { 'path': 'generics_impl::Aaaaaaa', 'name': 'read' }, ], }, { - // Read -> u64 + 'query': 'Read -> u64', 'others': [ { 'path': 'generics_impl::Ddddddd', 'name': 'eeeeeee' }, { 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' }, ], }, { - // trait:Read -> u64 + 'query': 'trait:Read -> u64', 'others': [ { 'path': 'generics_impl::Ddddddd', 'name': 'eeeeeee' }, { 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' }, ], }, { - // struct:Read -> u64 + 'query': 'struct:Read -> u64', 'others': [], }, { - // bool -> u64 + 'query': 'bool -> u64', 'others': [ { 'path': 'generics_impl::Ddddddd', 'name': 'fffffff' }, ], }, { - // Ddddddd -> u64 + 'query': 'Ddddddd -> u64', 'others': [ { 'path': 'generics_impl::Ddddddd', 'name': 'ggggggg' }, ], }, { - // -> Ddddddd + 'query': '-> Ddddddd', 'others': [ { 'path': 'generics_impl::Ddddddd', 'name': 'hhhhhhh' }, ], diff --git a/tests/rustdoc-js/generics-match-ambiguity.js b/tests/rustdoc-js/generics-match-ambiguity.js new file mode 100644 index 000000000..a9932a16c --- /dev/null +++ b/tests/rustdoc-js/generics-match-ambiguity.js @@ -0,0 +1,91 @@ +// ignore-order +// exact-check + +// Make sure that results are order-agnostic, even when there's search items that only differ +// by generics. + +const EXPECTED = [ + { + 'query': 'Wrap', + 'in_args': [ + { 'path': 'generics_match_ambiguity', 'name': 'bar' }, + { 'path': 'generics_match_ambiguity', 'name': 'foo' }, + ], + }, + { + 'query': 'Wrap<i32>', + 'in_args': [ + { 'path': 'generics_match_ambiguity', 'name': 'bar' }, + { 'path': 'generics_match_ambiguity', 'name': 'foo' }, + ], + }, + { + 'query': 'Wrap<i32>, Wrap<i32, u32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'bar' }, + { 'path': 'generics_match_ambiguity', 'name': 'foo' }, + ], + }, + { + 'query': 'Wrap<i32, u32>, Wrap<i32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'bar' }, + { 'path': 'generics_match_ambiguity', 'name': 'foo' }, + ], + }, + { + 'query': 'W3<i32>, W3<i32, u32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'baaa' }, + { 'path': 'generics_match_ambiguity', 'name': 'baab' }, + { 'path': 'generics_match_ambiguity', 'name': 'baac' }, + { 'path': 'generics_match_ambiguity', 'name': 'baad' }, + { 'path': 'generics_match_ambiguity', 'name': 'baae' }, + { 'path': 'generics_match_ambiguity', 'name': 'baaf' }, + { 'path': 'generics_match_ambiguity', 'name': 'baag' }, + { 'path': 'generics_match_ambiguity', 'name': 'baah' }, + ], + }, + { + 'query': 'W3<i32, u32>, W3<i32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'baaa' }, + { 'path': 'generics_match_ambiguity', 'name': 'baab' }, + { 'path': 'generics_match_ambiguity', 'name': 'baac' }, + { 'path': 'generics_match_ambiguity', 'name': 'baad' }, + { 'path': 'generics_match_ambiguity', 'name': 'baae' }, + { 'path': 'generics_match_ambiguity', 'name': 'baaf' }, + { 'path': 'generics_match_ambiguity', 'name': 'baag' }, + { 'path': 'generics_match_ambiguity', 'name': 'baah' }, + ], + }, + { + 'query': 'W2<i32>, W2<i32, u32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'baag' }, + { 'path': 'generics_match_ambiguity', 'name': 'baah' }, + ], + }, + { + 'query': 'W2<i32, u32>, W2<i32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'baag' }, + { 'path': 'generics_match_ambiguity', 'name': 'baah' }, + ], + }, + { + 'query': 'W2<i32>, W3<i32, u32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'baac' }, + { 'path': 'generics_match_ambiguity', 'name': 'baaf' }, + { 'path': 'generics_match_ambiguity', 'name': 'baag' }, + ], + }, + { + 'query': 'W2<i32>, W2<i32>', + 'others': [ + { 'path': 'generics_match_ambiguity', 'name': 'baag' }, + { 'path': 'generics_match_ambiguity', 'name': 'baah' }, + ], + }, +]; diff --git a/tests/rustdoc-js/generics-match-ambiguity.rs b/tests/rustdoc-js/generics-match-ambiguity.rs new file mode 100644 index 000000000..79c493856 --- /dev/null +++ b/tests/rustdoc-js/generics-match-ambiguity.rs @@ -0,0 +1,17 @@ +pub struct Wrap<T, U = ()>(pub T, pub U); + +pub fn foo(a: Wrap<i32>, b: Wrap<i32, u32>) {} +pub fn bar(a: Wrap<i32, u32>, b: Wrap<i32>) {} + +pub struct W2<T>(pub T); +pub struct W3<T, U = ()>(pub T, pub U); + +pub fn baaa(a: W3<i32>, b: W3<i32, u32>) {} +pub fn baab(a: W3<i32, u32>, b: W3<i32>) {} +pub fn baac(a: W2<W3<i32>>, b: W3<i32, u32>) {} +pub fn baad(a: W2<W3<i32, u32>>, b: W3<i32>) {} +pub fn baae(a: W3<i32>, b: W2<W3<i32, u32>>) {} +pub fn baaf(a: W3<i32, u32>, b: W2<W3<i32>>) {} +pub fn baag(a: W2<W3<i32>>, b: W2<W3<i32, u32>>) {} +pub fn baah(a: W2<W3<i32, u32>>, b: W2<W3<i32>>) {} +// diff --git a/tests/rustdoc-js/generics-multi-trait.js b/tests/rustdoc-js/generics-multi-trait.js index e7fcea876..7097cabe7 100644 --- a/tests/rustdoc-js/generics-multi-trait.js +++ b/tests/rustdoc-js/generics-multi-trait.js @@ -1,14 +1,9 @@ // exact-check -const QUERY = [ - 'Result<SomeTrait>', - 'Zzzzzzzzzzzzzzzzzz', - 'Nonononononononono', -]; - const EXPECTED = [ // check one of the generic items { + 'query': 'Result<SomeTrait>', 'in_args': [ { 'path': 'generics_multi_trait', 'name': 'beta' }, ], @@ -17,6 +12,7 @@ const EXPECTED = [ ], }, { + 'query': 'Zzzzzzzzzzzzzzzzzz', 'in_args': [ { 'path': 'generics_multi_trait', 'name': 'beta' }, ], @@ -26,6 +22,7 @@ const EXPECTED = [ }, // ignore the name of the generic itself { + 'query': 'Nonononononononono', 'in_args': [], 'returned': [], }, diff --git a/tests/rustdoc-js/generics-nested.js b/tests/rustdoc-js/generics-nested.js index 8701f2d49..294c19490 100644 --- a/tests/rustdoc-js/generics-nested.js +++ b/tests/rustdoc-js/generics-nested.js @@ -1,31 +1,24 @@ // exact-check -const QUERY = [ - '-> Out<First<Second>>', - '-> Out<Second<First>>', - '-> Out<First, Second>', - '-> Out<Second, First>', -]; - const EXPECTED = [ { - // -> Out<First<Second>> + 'query': '-> Out<First<Second>>', 'others': [ { 'path': 'generics_nested', 'name': 'alef' }, ], }, { - // -> Out<Second<First>> + 'query': '-> Out<Second<First>>', 'others': [], }, { - // -> Out<First, Second> + 'query': '-> Out<First, Second>', 'others': [ { 'path': 'generics_nested', 'name': 'bet' }, ], }, { - // -> Out<Second, First> + 'query': '-> Out<Second, First>', 'others': [ { 'path': 'generics_nested', 'name': 'bet' }, ], diff --git a/tests/rustdoc-js/generics-trait.js b/tests/rustdoc-js/generics-trait.js index 0e8475160..4ccfb8f4e 100644 --- a/tests/rustdoc-js/generics-trait.js +++ b/tests/rustdoc-js/generics-trait.js @@ -1,22 +1,9 @@ // exact-check -const QUERY = [ - 'Result<SomeTrait>', - 'Result<SomeTraiz>', - 'OtherThingxxxxxxxx', - 'OtherThingxxxxxxxy', -]; - -const CORRECTIONS = [ - null, - null, - null, - 'OtherThingxxxxxxxx', -]; - const EXPECTED = [ - // Result<SomeTrait> { + 'query': 'Result<SomeTrait>', + 'correction': null, 'in_args': [ { 'path': 'generics_trait', 'name': 'beta' }, ], @@ -24,13 +11,15 @@ const EXPECTED = [ { 'path': 'generics_trait', 'name': 'bet' }, ], }, - // Result<SomeTraiz> { + 'query': 'Result<SomeTraiz>', + 'correction': null, 'in_args': [], 'returned': [], }, - // OtherThingxxxxxxxx { + 'query': 'OtherThingxxxxxxxx', + 'correction': null, 'in_args': [ { 'path': 'generics_trait', 'name': 'alpha' }, ], @@ -38,8 +27,9 @@ const EXPECTED = [ { 'path': 'generics_trait', 'name': 'alef' }, ], }, - // OtherThingxxxxxxxy { + 'query': 'OtherThingxxxxxxxy', + 'correction': 'OtherThingxxxxxxxx', 'in_args': [ { 'path': 'generics_trait', 'name': 'alpha' }, ], diff --git a/tests/rustdoc-js/generics.js b/tests/rustdoc-js/generics.js index f79c709ad..ebc92ccfc 100644 --- a/tests/rustdoc-js/generics.js +++ b/tests/rustdoc-js/generics.js @@ -1,20 +1,8 @@ // exact-check -const QUERY = [ - 'R<P>', - 'R<struct:P>', - 'R<enum:P>', - '"P"', - 'P', - 'ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>', - 'TraitCat', - 'TraitDog', - 'Result<String>', -]; - const EXPECTED = [ { - // R<P> + 'query': 'R<P>', 'returned': [ { 'path': 'generics', 'name': 'alef' }, ], @@ -23,7 +11,7 @@ const EXPECTED = [ ], }, { - // R<struct:P> + 'query': 'R<struct:P>', 'returned': [ { 'path': 'generics', 'name': 'alef' }, ], @@ -32,12 +20,12 @@ const EXPECTED = [ ], }, { - // R<enum:P> + 'query': 'R<enum:P>', 'returned': [], 'in_args': [], }, { - // "P" + 'query': '"P"', 'others': [ { 'path': 'generics', 'name': 'P' }, ], @@ -49,7 +37,7 @@ const EXPECTED = [ ], }, { - // P + 'query': 'P', 'returned': [ { 'path': 'generics', 'name': 'alef' }, ], @@ -58,26 +46,26 @@ const EXPECTED = [ ], }, { - // "ExtraCreditStructMulti"<ExtraCreditInnerMulti, ExtraCreditInnerMulti> + 'query': '"ExtraCreditStructMulti"<ExtraCreditInnerMulti, ExtraCreditInnerMulti>', 'in_args': [ { 'path': 'generics', 'name': 'extracreditlabhomework' }, ], 'returned': [], }, { - // TraitCat + 'query': 'TraitCat', 'in_args': [ { 'path': 'generics', 'name': 'gamma' }, ], }, { - // TraitDog + 'query': 'TraitDog', 'in_args': [ { 'path': 'generics', 'name': 'gamma' }, ], }, { - // Result<String> + 'query': 'Result<String>', 'others': [], 'returned': [ { 'path': 'generics', 'name': 'super_soup' }, diff --git a/tests/rustdoc-js/impl-trait.js b/tests/rustdoc-js/impl-trait.js index 8d594bf8a..710e594b5 100644 --- a/tests/rustdoc-js/impl-trait.js +++ b/tests/rustdoc-js/impl-trait.js @@ -1,32 +1,24 @@ // ignore-order -const QUERY = [ - 'Aaaaaaa -> i32', - 'Aaaaaaa -> Aaaaaaa', - 'Aaaaaaa -> usize', - '-> Aaaaaaa', - 'Aaaaaaa', -]; - const EXPECTED = [ { - // Aaaaaaa -> i32 + 'query': 'Aaaaaaa -> i32', 'others': [ { 'path': 'impl_trait::Ccccccc', 'name': 'eeeeeee' }, ], }, { - // Aaaaaaa -> Aaaaaaa + 'query': 'Aaaaaaa -> Aaaaaaa', 'others': [ { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, ], }, { - // Aaaaaaa -> usize + 'query': 'Aaaaaaa -> usize', 'others': [], }, { - // -> Aaaaaaa + 'query': '-> Aaaaaaa', 'others': [ { 'path': 'impl_trait::Ccccccc', 'name': 'fffffff' }, { 'path': 'impl_trait::Ccccccc', 'name': 'ddddddd' }, @@ -34,7 +26,7 @@ const EXPECTED = [ ], }, { - // Aaaaaaa + 'query': 'Aaaaaaa', 'others': [ { 'path': 'impl_trait', 'name': 'Aaaaaaa' }, ], diff --git a/tests/rustdoc-js/macro-search.js b/tests/rustdoc-js/macro-search.js index 2b179ce14..241f7f172 100644 --- a/tests/rustdoc-js/macro-search.js +++ b/tests/rustdoc-js/macro-search.js @@ -1,8 +1,7 @@ // exact-check -const QUERY = 'abracadabra!'; - const EXPECTED = { + 'query': 'abracadabra!', 'others': [ { 'path': 'macro_search', 'name': 'abracadabra' }, { 'path': 'macro_search', 'name': 'abracadabra_b' }, diff --git a/tests/rustdoc-js/module-substring.js b/tests/rustdoc-js/module-substring.js index f17a97f13..7a10397eb 100644 --- a/tests/rustdoc-js/module-substring.js +++ b/tests/rustdoc-js/module-substring.js @@ -1,6 +1,5 @@ -const QUERY = 'ig::pc'; - const EXPECTED = { + 'query': 'ig::pc', 'others': [ { 'path': 'module_substring::Sig', 'name': 'pc' }, { 'path': 'module_substring::Si', 'name': 'pc' }, diff --git a/tests/rustdoc-js/nested-unboxed.js b/tests/rustdoc-js/nested-unboxed.js new file mode 100644 index 000000000..44f784eb1 --- /dev/null +++ b/tests/rustdoc-js/nested-unboxed.js @@ -0,0 +1,68 @@ +// exact-check + +const EXPECTED = [ + { + 'query': '-> Result<Object, bool>', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> Result<Object<i32, u32>, bool>', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> Object, bool', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> Object<i32, u32>, bool', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> i32, u32, bool', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> Result<i32, u32, bool>', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> Result<Object<i32>, bool>', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> Result<Object<u32>, bool>', + 'others': [ + { 'path': 'nested_unboxed', 'name': 'something' }, + ], + }, + { + 'query': '-> Result<Object<i32>, u32, bool>', + 'others': [], + }, + { + 'query': '-> Result<i32, Object<u32>, bool>', + 'others': [], + }, + { + 'query': '-> Result<i32, u32, Object<bool>>', + 'others': [], + }, + { + 'query': '-> Result<Object<i32>, Object<u32>, bool>', + 'others': [], + }, +]; diff --git a/tests/rustdoc-js/nested-unboxed.rs b/tests/rustdoc-js/nested-unboxed.rs new file mode 100644 index 000000000..57f9592b7 --- /dev/null +++ b/tests/rustdoc-js/nested-unboxed.rs @@ -0,0 +1,5 @@ +pub struct Object<T, U>(T, U); + +pub fn something() -> Result<Object<i32, u32>, bool> { + loop {} +} diff --git a/tests/rustdoc-js/never-search.js b/tests/rustdoc-js/never-search.js new file mode 100644 index 000000000..ed24d6931 --- /dev/null +++ b/tests/rustdoc-js/never-search.js @@ -0,0 +1,46 @@ +// exact-check + +const EXPECTED = [ + { + 'query': '-> !', + 'others': [ + { 'path': 'never_search', 'name': 'loops' }, + ], + }, + { + 'query': '-> never', + 'others': [ + { 'path': 'never_search', 'name': 'loops' }, + { 'path': 'never_search', 'name': 'returns' }, + ], + }, + { + 'query': '!', + 'in_args': [ + { 'path': 'never_search', 'name': 'impossible' }, + { 'path': 'never_search', 'name': 'box_impossible' }, + ], + }, + { + 'query': 'never', + 'in_args': [ + { 'path': 'never_search', 'name': 'impossible' }, + { 'path': 'never_search', 'name': 'uninteresting' }, + { 'path': 'never_search', 'name': 'box_impossible' }, + { 'path': 'never_search', 'name': 'box_uninteresting' }, + ], + }, + { + 'query': 'box<!>', + 'in_args': [ + { 'path': 'never_search', 'name': 'box_impossible' }, + ], + }, + { + 'query': 'box<never>', + 'in_args': [ + { 'path': 'never_search', 'name': 'box_impossible' }, + { 'path': 'never_search', 'name': 'box_uninteresting' }, + ], + }, +]; diff --git a/tests/rustdoc-js/never-search.rs b/tests/rustdoc-js/never-search.rs new file mode 100644 index 000000000..299b4660d --- /dev/null +++ b/tests/rustdoc-js/never-search.rs @@ -0,0 +1,13 @@ +#![feature(never_type)] + +#[allow(nonstandard_style)] +pub struct never; + +pub fn loops() -> ! { loop {} } +pub fn returns() -> never { never } + +pub fn impossible(x: !) { match x {} } +pub fn uninteresting(x: never) { match x { never => {} } } + +pub fn box_impossible(x: Box<!>) { match *x {} } +pub fn box_uninteresting(x: Box<never>) { match *x { never => {} } } diff --git a/tests/rustdoc-js/path-ordering.js b/tests/rustdoc-js/path-ordering.js index 4aee569b0..f2e6fe2fa 100644 --- a/tests/rustdoc-js/path-ordering.js +++ b/tests/rustdoc-js/path-ordering.js @@ -1,8 +1,7 @@ // exact-check -const QUERY = 'b::ccccccc'; - const EXPECTED = { + 'query': 'b::ccccccc', 'others': [ // `ccccccc` is an exact match for all three of these. // However `b` is a closer match for `bb` than for any diff --git a/tests/rustdoc-js/primitive.js b/tests/rustdoc-js/primitive.js index 4aec98c34..ad8f6663a 100644 --- a/tests/rustdoc-js/primitive.js +++ b/tests/rustdoc-js/primitive.js @@ -1,33 +1,30 @@ // exact-check -const QUERY = [ - "i32", - "str", - "primitive:str", - "struct:str", - "TotoIsSomewhere", -]; - const EXPECTED = [ { + 'query': 'i32', 'in_args': [ { 'path': 'primitive', 'name': 'foo' }, ], }, { + 'query': 'str', 'returned': [ { 'path': 'primitive', 'name': 'foo' }, ], }, { + 'query': 'primitive:str', 'returned': [ { 'path': 'primitive', 'name': 'foo' }, ], }, { + 'query': 'struct:str', 'returned': [], }, { + 'query': 'TotoIsSomewhere', 'others': [], 'in_args': [], 'returned': [], diff --git a/tests/rustdoc-js/prototype.js b/tests/rustdoc-js/prototype.js index 2f1d841c3..da72fdce3 100644 --- a/tests/rustdoc-js/prototype.js +++ b/tests/rustdoc-js/prototype.js @@ -1,14 +1,14 @@ // exact-check -const QUERY = ['constructor', '__proto__']; - const EXPECTED = [ { + 'query': 'constructor', 'others': [], 'returned': [], 'in_args': [], }, { + 'query': '__proto__', 'others': [], 'returned': [], 'in_args': [], diff --git a/tests/rustdoc-js/raw-pointer.js b/tests/rustdoc-js/raw-pointer.js index 140b955ea..f2b1294ee 100644 --- a/tests/rustdoc-js/raw-pointer.js +++ b/tests/rustdoc-js/raw-pointer.js @@ -1,33 +1,25 @@ // ignore-order -const QUERY = [ - 'Aaaaaaa -> i32', - 'Aaaaaaa -> Aaaaaaa', - 'Aaaaaaa -> usize', - '-> Aaaaaaa', - 'Aaaaaaa', -]; - const EXPECTED = [ { - // Aaaaaaa -> i32 + 'query': 'Aaaaaaa -> i32', 'others': [ { 'path': 'raw_pointer::Ccccccc', 'name': 'eeeeeee' }, ], }, { - // Aaaaaaa -> Aaaaaaa + 'query': 'Aaaaaaa -> Aaaaaaa', 'others': [ { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' }, { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' }, ], }, { - // Aaaaaaa -> usize + 'query': 'Aaaaaaa -> usize', 'others': [], }, { - // -> Aaaaaaa + 'query': '-> Aaaaaaa', 'others': [ { 'path': 'raw_pointer::Ccccccc', 'name': 'fffffff' }, { 'path': 'raw_pointer::Ccccccc', 'name': 'ggggggg' }, @@ -36,7 +28,7 @@ const EXPECTED = [ ], }, { - // Aaaaaaa + 'query': 'Aaaaaaa', 'others': [ { 'path': 'raw_pointer', 'name': 'Aaaaaaa' }, ], diff --git a/tests/rustdoc-js/reexport.js b/tests/rustdoc-js/reexport.js index 871e75d9b..9021cc2e9 100644 --- a/tests/rustdoc-js/reexport.js +++ b/tests/rustdoc-js/reexport.js @@ -1,15 +1,15 @@ // exact-check -const QUERY = ['Subscriber', 'AnotherOne']; - const EXPECTED = [ { + 'query': 'Subscriber', 'others': [ { 'path': 'reexport::fmt', 'name': 'Subscriber' }, { 'path': 'reexport', 'name': 'FmtSubscriber' }, ], }, { + 'query': 'AnotherOne', 'others': [ { 'path': 'reexport', 'name': 'AnotherOne' }, ], diff --git a/tests/rustdoc-js/search-bag-semantics.js b/tests/rustdoc-js/search-bag-semantics.js index c56a3df5f..4b598cd80 100644 --- a/tests/rustdoc-js/search-bag-semantics.js +++ b/tests/rustdoc-js/search-bag-semantics.js @@ -1,18 +1,15 @@ // exact-check -const QUERY = [ - 'P', - 'P, P', -]; - const EXPECTED = [ { + 'query': 'P', 'in_args': [ { 'path': 'search_bag_semantics', 'name': 'alacazam' }, { 'path': 'search_bag_semantics', 'name': 'abracadabra' }, ], }, { + 'query': 'P, P', 'others': [ { 'path': 'search_bag_semantics', 'name': 'abracadabra' }, ], diff --git a/tests/rustdoc-js/search-short-types.js b/tests/rustdoc-js/search-short-types.js index 3b2f15a40..5048e0443 100644 --- a/tests/rustdoc-js/search-short-types.js +++ b/tests/rustdoc-js/search-short-types.js @@ -1,6 +1,5 @@ -const QUERY = 'P'; - const EXPECTED = { + 'query': 'P', 'others': [ { 'path': 'search_short_types', 'name': 'P' }, { 'path': 'search_short_types::VeryLongTypeName', 'name': 'p' }, diff --git a/tests/rustdoc-js/slice-array.js b/tests/rustdoc-js/slice-array.js index 8c21e06dc..d676d0577 100644 --- a/tests/rustdoc-js/slice-array.js +++ b/tests/rustdoc-js/slice-array.js @@ -1,65 +1,73 @@ // exact-check -const QUERY = [ - 'R<primitive:slice<P>>', - 'primitive:slice<R<P>>', - 'R<primitive:slice<Q>>', - 'primitive:slice<R<Q>>', - 'R<primitive:array<Q>>', - 'primitive:array<R<Q>>', - 'primitive:array<TraitCat>', - 'primitive:array<TraitDog>', -]; - const EXPECTED = [ { - // R<primitive:slice<P>> + 'query': 'R<primitive:slice<P>>', 'returned': [], 'in_args': [ { 'path': 'slice_array', 'name': 'alpha' }, ], }, { - // primitive:slice<R<P>> + 'query': 'primitive:slice<R<P>>', 'returned': [ { 'path': 'slice_array', 'name': 'alef' }, ], 'in_args': [], }, { - // R<primitive:slice<Q>> + 'query': 'R<primitive:slice<Q>>', 'returned': [], 'in_args': [], }, { - // primitive:slice<R<Q>> + 'query': 'primitive:slice<R<Q>>', 'returned': [], 'in_args': [], }, { - // R<primitive:array<Q>> + 'query': 'R<primitive:array<Q>>', 'returned': [ { 'path': 'slice_array', 'name': 'bet' }, ], 'in_args': [], }, { - // primitive:array<R<Q>> + 'query': 'primitive:array<R<Q>>', 'returned': [], 'in_args': [ { 'path': 'slice_array', 'name': 'beta' }, ], }, { - // primitive::array<TraitCat> + 'query': 'primitive:array<TraitCat>', 'in_args': [ { 'path': 'slice_array', 'name': 'gamma' }, ], }, { - // primitive::array<TraitDog> + 'query': 'primitive:array<TraitDog>', 'in_args': [ { 'path': 'slice_array', 'name': 'gamma' }, ], }, + { + 'query': '[TraitCat]', + 'in_args': [ + { 'path': 'slice_array', 'name': 'gamma' }, + { 'path': 'slice_array', 'name': 'epsilon' }, + ], + }, + { + 'query': 'R<[Q]>', + 'returned': [ + { 'path': 'slice_array', 'name': 'bet' }, + ], + }, + { + 'query': 'R<[P]>', + 'in_args': [ + { 'path': 'slice_array', 'name': 'alpha' }, + ], + }, ]; diff --git a/tests/rustdoc-js/slice-array.rs b/tests/rustdoc-js/slice-array.rs index 2523b21cf..15ac4294f 100644 --- a/tests/rustdoc-js/slice-array.rs +++ b/tests/rustdoc-js/slice-array.rs @@ -14,3 +14,5 @@ pub trait TraitCat {} pub trait TraitDog {} pub fn gamma<T: TraitCat + TraitDog>(t: [T; 32]) {} + +pub fn epsilon<T: TraitCat + TraitDog>(t: &[T]) {} diff --git a/tests/rustdoc-js/struct-like-variant.js b/tests/rustdoc-js/struct-like-variant.js index f6deea51e..7b9bec7ae 100644 --- a/tests/rustdoc-js/struct-like-variant.js +++ b/tests/rustdoc-js/struct-like-variant.js @@ -1,6 +1,5 @@ -const QUERY = 'name'; - const EXPECTED = { + 'query': 'name', 'others': [ { 'path': 'struct_like_variant::Enum::Bar', 'name': 'name', 'desc': 'This is a name.' }, ], diff --git a/tests/rustdoc-js/substring.js b/tests/rustdoc-js/substring.js index af05cd1ad..96efa992b 100644 --- a/tests/rustdoc-js/substring.js +++ b/tests/rustdoc-js/substring.js @@ -1,6 +1,5 @@ -const QUERY = 'waker_from'; - const EXPECTED = { + 'query': 'waker_from', 'others': [ { 'path': 'substring::SuperWaker', 'name': 'local_waker_from_nonlocal' }, { 'path': 'substring::SuperWakerTask', 'name': 'local_waker_from_nonlocal' }, diff --git a/tests/rustdoc-js/summaries.js b/tests/rustdoc-js/summaries.js index dfb11e804..ae3aefb0c 100644 --- a/tests/rustdoc-js/summaries.js +++ b/tests/rustdoc-js/summaries.js @@ -1,19 +1,20 @@ // ignore-tidy-linelength -const QUERY = ['summaries', 'summaries::Sidebar', 'summaries::Sidebar2']; - const EXPECTED = [ { + 'query': 'summaries', 'others': [ { 'path': '', 'name': 'summaries', 'desc': 'This <em>summary</em> has a link, [<code>code</code>], and <code>Sidebar2</code> intra-doc.' }, ], }, { + 'query': 'summaries::Sidebar', 'others': [ { 'path': 'summaries', 'name': 'Sidebar', 'desc': 'This <code>code</code> will be rendered in a code tag.' }, ], }, { + 'query': 'summaries::Sidebar2', 'others': [ { 'path': 'summaries', 'name': 'Sidebar2', 'desc': '' }, ], diff --git a/tests/rustdoc-js/where-clause.js b/tests/rustdoc-js/where-clause.js index 86254a80e..8dccf197b 100644 --- a/tests/rustdoc-js/where-clause.js +++ b/tests/rustdoc-js/where-clause.js @@ -1,28 +1,31 @@ -const QUERY = ['trait<nested>', '-> trait<nested>', 't1, t2', '-> shazam', 'drizzel -> shazam']; - const EXPECTED = [ { + 'query': 'trait<nested>', 'in_args': [ { 'path': 'where_clause', 'name': 'abracadabra' }, ], }, { + 'query': '-> trait<nested>', 'others': [ { 'path': 'where_clause', 'name': 'alacazam' }, ], }, { + 'query': 't1, t2', 'others': [ { 'path': 'where_clause', 'name': 'presto' }, ], }, { + 'query': '-> shazam', 'others': [ { 'path': 'where_clause', 'name': 'bippety' }, { 'path': 'where_clause::Drizzel', 'name': 'boppety' }, ], }, { + 'query': 'drizzel -> shazam', 'others': [ { 'path': 'where_clause::Drizzel', 'name': 'boppety' }, ], |