diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-07-21 13:19:17 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-07-22 21:02:44 +0200 |
| commit | 6b830ec23e25f3e325e97fc49b0bec9a7f2a5b53 (patch) | |
| tree | 8350b822ae31b1ed80f9103bcdcfaaebbbc5030a /src/test/rustdoc | |
| parent | 3e96ac1178f2350dc35b8d601d3667c6496bf801 (diff) | |
| download | rust-6b830ec23e25f3e325e97fc49b0bec9a7f2a5b53.tar.gz rust-6b830ec23e25f3e325e97fc49b0bec9a7f2a5b53.zip | |
Add new tests and fix old ones
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/generic-impl.rs | 25 | ||||
| -rw-r--r-- | src/test/rustdoc/manual_impl.rs | 1 | ||||
| -rw-r--r-- | src/test/rustdoc/sidebar-items.rs | 8 | ||||
| -rw-r--r-- | src/test/rustdoc/synthetic_auto/basic.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/synthetic_auto/manual.rs | 2 |
5 files changed, 31 insertions, 7 deletions
diff --git a/src/test/rustdoc/generic-impl.rs b/src/test/rustdoc/generic-impl.rs new file mode 100644 index 00000000000..68277835d2b --- /dev/null +++ b/src/test/rustdoc/generic-impl.rs @@ -0,0 +1,25 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name = "foo"] + +use std::fmt; + +// @!has foo/struct.Bar.html 'impl<T> ToString for Bar' +pub struct Bar; + +// @has foo/struct.Foo.html '//h3[@id="impl-ToString"]//code' 'impl<T> ToString for Foo' +pub struct Foo; + +impl fmt::Display for Foo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Foo") + } +} diff --git a/src/test/rustdoc/manual_impl.rs b/src/test/rustdoc/manual_impl.rs index befd3161ac4..54a8a764833 100644 --- a/src/test/rustdoc/manual_impl.rs +++ b/src/test/rustdoc/manual_impl.rs @@ -56,7 +56,6 @@ impl T for S1 { // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.' // @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.' // @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.' -// @!has - '//*[@class="docblock"]' 'Read more' pub struct S2(usize); /// Docs associated with the S2 trait implementation. diff --git a/src/test/rustdoc/sidebar-items.rs b/src/test/rustdoc/sidebar-items.rs index 9be40441e9d..3ecd6b63510 100644 --- a/src/test/rustdoc/sidebar-items.rs +++ b/src/test/rustdoc/sidebar-items.rs @@ -31,11 +31,11 @@ pub trait Foo { // @has - '//*[@class="sidebar-title"][@href="#fields"]' 'Fields' // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f"]' 'f' // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.u"]' 'u' -// @!has - '//*[@class="sidebar-links"]/a' 'w' +// @!has - '//*[@class="sidebar-links"]/a' 'waza' pub struct Bar { pub f: u32, pub u: u32, - w: u32, + waza: u32, } // @has foo/enum.En.html @@ -51,9 +51,9 @@ pub enum En { // @has - '//*[@class="sidebar-title"][@href="#fields"]' 'Fields' // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f1"]' 'f1' // @has - '//*[@class="sidebar-links"]/a[@href="#structfield.f2"]' 'f2' -// @!has - '//*[@class="sidebar-links"]/a' 'w' +// @!has - '//*[@class="sidebar-links"]/a' 'waza' pub union MyUnion { pub f1: u32, pub f2: f32, - w: u32, + waza: u32, } diff --git a/src/test/rustdoc/synthetic_auto/basic.rs b/src/test/rustdoc/synthetic_auto/basic.rs index 8ff84d11a50..200747bf6cd 100644 --- a/src/test/rustdoc/synthetic_auto/basic.rs +++ b/src/test/rustdoc/synthetic_auto/basic.rs @@ -12,7 +12,7 @@ // @has - '//code' 'impl<T> Send for Foo<T> where T: Send' // @has - '//code' 'impl<T> Sync for Foo<T> where T: Sync' // @count - '//*[@id="implementations-list"]/*[@class="impl"]' 0 -// @count - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]' 2 +// @count - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]' 11 pub struct Foo<T> { field: T, } diff --git a/src/test/rustdoc/synthetic_auto/manual.rs b/src/test/rustdoc/synthetic_auto/manual.rs index ef6797ecf3c..461b922e28e 100644 --- a/src/test/rustdoc/synthetic_auto/manual.rs +++ b/src/test/rustdoc/synthetic_auto/manual.rs @@ -16,7 +16,7 @@ // 'impl<T> Send for Foo<T>' // // @count - '//*[@id="implementations-list"]/*[@class="impl"]' 1 -// @count - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]' 1 +// @count - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]' 10 pub struct Foo<T> { field: T, } |
