Skip to content

Commit

Permalink
rustdoc: add test case for multiple traits and erased names
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Jan 26, 2022
1 parent a7f3757 commit f5cdfb4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/test/rustdoc-js/generics-multi-trait.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// exact-check

const QUERY = [
'Result<SomeTrait>',
'Zzzzzzzzzzzzzzzzzz',
'Nonononononononono',
];

const EXPECTED = [
// check one of the generic items
{
'in_args': [
{ 'path': 'generics_multi_trait', 'name': 'beta' },
],
'returned': [
{ 'path': 'generics_multi_trait', 'name': 'bet' },
],
},
{
'in_args': [
{ 'path': 'generics_multi_trait', 'name': 'beta' },
],
'returned': [
{ 'path': 'generics_multi_trait', 'name': 'bet' },
],
},
// ignore the name of the generic itself
{
'in_args': [],
'returned': [],
},
];
12 changes: 12 additions & 0 deletions src/test/rustdoc-js/generics-multi-trait.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pub trait SomeTrait {}
pub trait Zzzzzzzzzzzzzzzzzz {}

pub fn bet<Nonononononononono: SomeTrait + Zzzzzzzzzzzzzzzzzz>() -> Result<Nonononononononono, ()> {
loop {}
}

pub fn beta<Nonononononononono: SomeTrait + Zzzzzzzzzzzzzzzzzz>(
_param: Result<Nonononononononono, ()>,
) {
loop {}
}

0 comments on commit f5cdfb4

Please sign in to comment.