diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-06-21 14:03:08 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-06-24 11:08:41 +0200 |
| commit | 1b67035579fc6157ca2f3fb8b7e6071ff6d888bc (patch) | |
| tree | e53cb08e1dfa396dd2abd4ffbb91aa6826a463d9 /tests/rustdoc/async-fn.rs | |
| parent | d3ec92e16e7e78c273c0f996cad5122ce5a6cdd6 (diff) | |
| download | rust-1b67035579fc6157ca2f3fb8b7e6071ff6d888bc.tar.gz rust-1b67035579fc6157ca2f3fb8b7e6071ff6d888bc.zip | |
Update `tests/rustdoc` to new test syntax
Diffstat (limited to 'tests/rustdoc/async-fn.rs')
| -rw-r--r-- | tests/rustdoc/async-fn.rs | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/tests/rustdoc/async-fn.rs b/tests/rustdoc/async-fn.rs index 4de5d8575b0..3d49766c55e 100644 --- a/tests/rustdoc/async-fn.rs +++ b/tests/rustdoc/async-fn.rs @@ -1,43 +1,43 @@ //@ edition:2018 -// @has async_fn/fn.foo.html '//pre[@class="rust item-decl"]' 'pub async fn foo() -> Option<Foo>' +//@ has async_fn/fn.foo.html '//pre[@class="rust item-decl"]' 'pub async fn foo() -> Option<Foo>' pub async fn foo() -> Option<Foo> { None } -// @has async_fn/fn.bar.html '//pre[@class="rust item-decl"]' 'pub async fn bar(a: i32, b: i32) -> i32' +//@ has async_fn/fn.bar.html '//pre[@class="rust item-decl"]' 'pub async fn bar(a: i32, b: i32) -> i32' pub async fn bar(a: i32, b: i32) -> i32 { 0 } -// @has async_fn/fn.baz.html '//pre[@class="rust item-decl"]' 'pub async fn baz<T>(a: T) -> T' +//@ has async_fn/fn.baz.html '//pre[@class="rust item-decl"]' 'pub async fn baz<T>(a: T) -> T' pub async fn baz<T>(a: T) -> T { a } -// @has async_fn/fn.qux.html '//pre[@class="rust item-decl"]' 'pub async unsafe fn qux() -> char' +//@ has async_fn/fn.qux.html '//pre[@class="rust item-decl"]' 'pub async unsafe fn qux() -> char' pub async unsafe fn qux() -> char { '⚠' } -// @has async_fn/fn.mut_args.html '//pre[@class="rust item-decl"]' 'pub async fn mut_args(a: usize)' +//@ has async_fn/fn.mut_args.html '//pre[@class="rust item-decl"]' 'pub async fn mut_args(a: usize)' pub async fn mut_args(mut a: usize) {} -// @has async_fn/fn.mut_ref.html '//pre[@class="rust item-decl"]' 'pub async fn mut_ref(x: i32)' +//@ has async_fn/fn.mut_ref.html '//pre[@class="rust item-decl"]' 'pub async fn mut_ref(x: i32)' pub async fn mut_ref(ref mut x: i32) {} trait Bar {} impl Bar for () {} -// @has async_fn/fn.quux.html '//pre[@class="rust item-decl"]' 'pub async fn quux() -> impl Bar' +//@ has async_fn/fn.quux.html '//pre[@class="rust item-decl"]' 'pub async fn quux() -> impl Bar' pub async fn quux() -> impl Bar { () } -// @has async_fn/struct.Foo.html -// @matches - '//h4[@class="code-header"]' 'pub async fn f\(\)$' -// @matches - '//h4[@class="code-header"]' 'pub async unsafe fn g\(\)$' -// @matches - '//h4[@class="code-header"]' 'pub async fn mut_self\(self, first: usize\)$' +//@ has async_fn/struct.Foo.html +//@ matches - '//h4[@class="code-header"]' 'pub async fn f\(\)$' +//@ matches - '//h4[@class="code-header"]' 'pub async unsafe fn g\(\)$' +//@ matches - '//h4[@class="code-header"]' 'pub async fn mut_self\(self, first: usize\)$' pub struct Foo; impl Foo { @@ -51,49 +51,49 @@ pub trait Pattern<'a> {} impl Pattern<'_> for () {} pub trait Trait<const N: usize> {} -// @has async_fn/fn.const_generics.html -// @has - '//pre[@class="rust item-decl"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)' +//@ has async_fn/fn.const_generics.html +//@ has - '//pre[@class="rust item-decl"]' 'pub async fn const_generics<const N: usize>(_: impl Trait<N>)' pub async fn const_generics<const N: usize>(_: impl Trait<N>) {} // test that elided lifetimes are properly elided and not displayed as `'_` // regression test for #63037 -// @has async_fn/fn.elided.html -// @has - '//pre[@class="rust item-decl"]' 'pub async fn elided(foo: &str) -> &str' +//@ has async_fn/fn.elided.html +//@ has - '//pre[@class="rust item-decl"]' 'pub async fn elided(foo: &str) -> &str' pub async fn elided(foo: &str) -> &str { "" } // This should really be shown as written, but for implementation reasons it's difficult. // See `impl Clean for TyKind::Ref`. -// @has async_fn/fn.user_elided.html -// @has - '//pre[@class="rust item-decl"]' 'pub async fn user_elided(foo: &str) -> &str' +//@ has async_fn/fn.user_elided.html +//@ has - '//pre[@class="rust item-decl"]' 'pub async fn user_elided(foo: &str) -> &str' pub async fn user_elided(foo: &'_ str) -> &str { "" } -// @has async_fn/fn.static_trait.html -// @has - '//pre[@class="rust item-decl"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>' +//@ has async_fn/fn.static_trait.html +//@ has - '//pre[@class="rust item-decl"]' 'pub async fn static_trait(foo: &str) -> Box<dyn Bar>' pub async fn static_trait(foo: &str) -> Box<dyn Bar> { Box::new(()) } -// @has async_fn/fn.lifetime_for_trait.html -// @has - '//pre[@class="rust item-decl"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>" +//@ has async_fn/fn.lifetime_for_trait.html +//@ has - '//pre[@class="rust item-decl"]' "pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_>" pub async fn lifetime_for_trait(foo: &str) -> Box<dyn Bar + '_> { Box::new(()) } -// @has async_fn/fn.elided_in_input_trait.html -// @has - '//pre[@class="rust item-decl"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)" +//@ has async_fn/fn.elided_in_input_trait.html +//@ has - '//pre[@class="rust item-decl"]' "pub async fn elided_in_input_trait(t: impl Pattern<'_>)" pub async fn elided_in_input_trait(t: impl Pattern<'_>) {} struct AsyncFdReadyGuard<'a, T> { x: &'a T } impl Foo { - // @has async_fn/struct.Foo.html - // @has - '//*[@class="method"]' 'pub async fn complicated_lifetimes( &self, context: &impl Bar, ) -> impl Iterator<Item = &usize>' + //@ has async_fn/struct.Foo.html + //@ has - '//*[@class="method"]' 'pub async fn complicated_lifetimes( &self, context: &impl Bar, ) -> impl Iterator<Item = &usize>' pub async fn complicated_lifetimes(&self, context: &impl Bar) -> impl Iterator<Item = &usize> { [0].iter() } // taken from `tokio` as an example of a method that was particularly bad before - // @has - '//*[@class="method"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>" + //@ has - '//*[@class="method"]' "pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()>" pub async fn readable<T>(&self) -> Result<AsyncFdReadyGuard<'_, T>, ()> { Err(()) } - // @has - '//*[@class="method"]' "pub async fn mut_self(&mut self)" + //@ has - '//*[@class="method"]' "pub async fn mut_self(&mut self)" pub async fn mut_self(&mut self) {} } // test named lifetimes, just in case -// @has async_fn/fn.named.html -// @has - '//pre[@class="rust item-decl"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str" +//@ has async_fn/fn.named.html +//@ has - '//pre[@class="rust item-decl"]' "pub async fn named<'a, 'b>(foo: &'a str) -> &'b str" pub async fn named<'a, 'b>(foo: &'a str) -> &'b str { "" } -// @has async_fn/fn.named_trait.html -// @has - '//pre[@class="rust item-decl"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>" +//@ has async_fn/fn.named_trait.html +//@ has - '//pre[@class="rust item-decl"]' "pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b>" pub async fn named_trait<'a, 'b>(foo: impl Pattern<'a>) -> impl Pattern<'b> {} |
