test: Move all run-make rustdoc tests to test/rustdoc

This commit is contained in:
Alex Crichton 2015-04-06 13:49:30 -07:00
parent 10359de405
commit d3647fe815
38 changed files with 125 additions and 213 deletions

View File

@ -472,7 +472,7 @@ DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
RUSTDOCCK_RS := $(wildcard $(S)src/test/rustdocck/*.rs)
RUSTDOCCK_RS := $(wildcard $(S)src/test/rustdoc/*.rs)
# perf tests are the same as bench tests only they run under
# a performance monitor.

View File

@ -1,5 +0,0 @@
-include ../tools.mk
all: lib.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
$(HTMLDOCCK) $(TMPDIR)/doc lib.rs

View File

@ -1,5 +0,0 @@
-include ../tools.mk
all: foo.rs bar.rs
$(RUSTC) foo.rs --crate-type lib
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc bar.rs -L $(TMPDIR)

View File

@ -1,6 +0,0 @@
-include ../tools.mk
all: lib.rs ext.rs
$(HOST_RPATH_ENV) $(RUSTC) ext.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc lib.rs
$(HTMLDOCCK) $(TMPDIR)/doc lib.rs

View File

@ -1,7 +0,0 @@
-include ../tools.mk
all: foo.rs bar.rs
$(HOST_RPATH_ENV) $(RUSTC) foo.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc bar.rs
$(HTMLDOCCK) $(TMPDIR)/doc bar.rs

View File

@ -1,8 +0,0 @@
-include ../tools.mk
all: lib.rs
$(HOST_RPATH_ENV) $(RUSTC) lib.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -L $(TMPDIR) -w html -o $(TMPDIR)/doc user.rs
$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
$(HTMLDOCCK) $(TMPDIR)/doc user.rs

View File

@ -1,15 +0,0 @@
-include ../tools.mk
# FIXME ignore windows
ifndef IS_WINDOWS
all:
@echo $(RUSTDOC)
$(HOST_RPATH_ENV) $(RUSTDOC) --test foo.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
else
all:
endif

View File

@ -1,5 +0,0 @@
-include ../tools.mk
all: lib.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
$(HTMLDOCCK) $(TMPDIR)/doc lib.rs

View File

@ -1,5 +0,0 @@
-include ../tools.mk
all: foo.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HTMLDOCCK) $(TMPDIR)/doc foo.rs

View File

@ -1,11 +0,0 @@
-include ../tools.mk
# FIXME ignore windows
ifndef IS_WINDOWS
all:
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo2.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo3.rs
else
all:
endif

View File

@ -1,15 +0,0 @@
-include ../tools.mk
# FIXME ignore windows
ifndef IS_WINDOWS
source=index.rs
all:
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc $(source)
$(HTMLDOCCK) $(TMPDIR)/doc $(source)
else
all:
endif

View File

@ -1,4 +0,0 @@
-include ../tools.mk
all:
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HTMLDOCCK) $(TMPDIR)/doc foo.rs

View File

@ -1,5 +0,0 @@
-include ../tools.mk
all:
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HTMLDOCCK) $(TMPDIR)/doc foo.rs
$(HTMLDOCCK) $(TMPDIR)/doc qux/mod.rs

View File

@ -1,43 +0,0 @@
// Copyright 2015 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"]
//! Dox
// @has src/foo/foo.rs.html
// @has foo/index.html '//a/@href' '../src/foo/foo.rs.html'
pub mod qux;
// @has foo/bar/index.html '//a/@href' '../../src/foo/foo.rs.html'
pub mod bar {
/// Dox
// @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/foo.rs.html'
pub mod baz {
/// Dox
// @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/foo.rs.html'
pub fn baz() { }
}
/// Dox
// @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/foo.rs.html'
pub trait Foobar { fn dummy(&self) { } }
// @has foo/bar/struct.Foo.html '//a/@href' '../../src/foo/foo.rs.html'
pub struct Foo { x: i32, y: u32 }
// @has foo/bar/fn.prawns.html '//a/@href' '../../src/foo/foo.rs.html'
pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
}
/// Dox
// @has foo/fn.modfn.html '//a/@href' '../src/foo/foo.rs.html'
pub fn modfn() { }

View File

@ -1,39 +0,0 @@
// Copyright 2015 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.
//! Dox
// @has src/foo/qux/mod.rs.html
// @has foo/qux/index.html '//a/@href' '../../src/foo/qux/mod.rs.html'
// @has foo/qux/bar/index.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
pub mod bar {
/// Dox
// @has foo/qux/bar/baz/index.html '//a/@href' '../../../../src/foo/qux/mod.rs.html'
pub mod baz {
/// Dox
// @has foo/qux/bar/baz/fn.baz.html '//a/@href' '../../../../src/foo/qux/mod.rs.html'
pub fn baz() { }
}
/// Dox
// @has foo/qux/bar/trait.Foobar.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
pub trait Foobar { fn dummy(&self) { } }
// @has foo/qux/bar/struct.Foo.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
pub struct Foo { x: i32, y: u32 }
// @has foo/qux/bar/fn.prawns.html '//a/@href' '../../../src/foo/qux/mod.rs.html'
pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
}
/// Dox
// @has foo/qux/fn.modfn.html '//a/@href' '../../src/foo/qux/mod.rs.html'
pub fn modfn() { }

View File

@ -1,5 +0,0 @@
-include ../tools.mk
all: foo.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HTMLDOCCK) $(TMPDIR)/doc foo.rs

View File

@ -1,5 +0,0 @@
-include ../tools.mk
all: foo.rs
$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
$(HTMLDOCCK) $(TMPDIR)/doc foo.rs

View File

@ -10,7 +10,7 @@
#![crate_type="lib"]
// @has lib/trait.Index.html
// @has assoc_types/trait.Index.html
pub trait Index<I: ?Sized> {
// @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized'
type Output: ?Sized;

View File

@ -8,7 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate foo;
// aux-build:rustdoc-default-impl.rs
extern crate rustdoc_default_impl as foo;
pub use foo::bar;

View File

@ -8,7 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
extern crate ext;
// aux-build:rustdoc-extern-default-method.rs
// @count lib/struct.Struct.html '//*[@id="method.provided"]' 1
extern crate rustdoc_extern_default_method as ext;
// @count extern_default_method/struct.Struct.html '//*[@id="method.provided"]' 1
pub use ext::Struct;

View File

@ -8,16 +8,18 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:rustdoc-extern-method.rs
#![feature(unboxed_closures)]
extern crate foo;
extern crate rustdoc_extern_method as foo;
// @has bar/trait.Foo.html //pre "pub trait Foo"
// @has extern_method/trait.Foo.html //pre "pub trait Foo"
// @has - '//*[@id="tymethod.foo"]//code' 'extern "rust-call" fn foo'
// @has - '//*[@id="tymethod.foo_"]//code' 'extern "rust-call" fn foo_'
pub use foo::Foo;
// @has bar/trait.Bar.html //pre "pub trait Bar"
// @has extern_method/trait.Bar.html //pre "pub trait Bar"
pub trait Bar {
// @has - '//*[@id="tymethod.bar"]//code' 'extern "rust-call" fn bar'
extern "rust-call" fn bar(&self, _: ());

View File

@ -8,9 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_type="lib"]
// aux-build:rustdoc-ffi.rs
extern crate lib;
extern crate rustdoc_ffi as lib;
// @has user/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
// @has ffi/fn.foreigner.html //pre 'pub unsafe fn foreigner(cold_as_ice: u32)'
pub use lib::foreigner;
extern "C" {
// @has ffi/fn.another.html //pre 'pub unsafe fn another(cold_as_ice: u32)'
pub fn another(cold_as_ice: u32);
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_name="foo"]
/// The '# ' lines should be removed from the output, but the #[derive] should be
/// retained.
///
@ -31,5 +29,5 @@
/// ```
pub fn foo() {}
// @!has foo/fn.foo.html invisible
// @!has hidden_line/fn.foo.html invisible
// @matches - //pre "#\[derive\(PartialEq\)\] // Bar"

View File

@ -8,15 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_type="lib"]
// @has lib/struct.Struct.html //pre '#[must_use]'
// @has must_use/struct.Struct.html //pre '#[must_use]'
#[must_use]
pub struct Struct {
field: i32,
}
// @has lib/enum.Enum.html //pre '#[must_use = "message"]'
// @has must_use/enum.Enum.html //pre '#[must_use = "message"]'
#[must_use = "message"]
pub enum Enum {
Variant(i32),

View File

@ -10,13 +10,13 @@
#![feature(optin_builtin_traits)]
// @matches foo/struct.Alpha.html '//pre' "pub struct Alpha"
// @matches negative_impl/struct.Alpha.html '//pre' "pub struct Alpha"
pub struct Alpha;
// @matches foo/struct.Bravo.html '//pre' "pub struct Bravo<B>"
// @matches negative_impl/struct.Bravo.html '//pre' "pub struct Bravo<B>"
pub struct Bravo<B>(B);
// @matches foo/struct.Alpha.html '//*[@class="impl"]//code' "impl !Send for Alpha"
// @matches negative_impl/struct.Alpha.html '//*[@class="impl"]//code' "impl !Send for Alpha"
impl !Send for Alpha {}
// @matches foo/struct.Bravo.html '//*[@class="impl"]//code' "impl<B> !Send for Bravo<B>"
// @matches negative_impl/struct.Bravo.html '//*[@class="impl"]//code' "impl<B> !Send for Bravo<B>"
impl<B> !Send for Bravo<B> {}

View File

@ -8,29 +8,28 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// @has foo/index.html
#![crate_name = "foo"]
// @has smoke/index.html
//! Very docs
// @has foo/bar/index.html
// @has smoke/bar/index.html
pub mod bar {
/// So correct
// @has foo/bar/baz/index.html
// @has smoke/bar/baz/index.html
pub mod baz {
/// Much detail
// @has foo/bar/baz/fn.baz.html
// @has smoke/bar/baz/fn.baz.html
pub fn baz() { }
}
/// *wow*
// @has foo/bar/trait.Doge.html
// @has smoke/bar/trait.Doge.html
pub trait Doge { fn dummy(&self) { } }
// @has foo/bar/struct.Foo.html
// @has smoke/bar/struct.Foo.html
pub struct Foo { x: isize, y: usize }
// @has foo/bar/fn.prawns.html
// @has smoke/bar/fn.prawns.html
pub fn prawns((a, b): (isize, usize), Foo { x, y }: Foo) { }
}

View File

@ -0,0 +1,56 @@
// Copyright 2015 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"]
//! Dox
// @has src/foo/src-links.rs.html
// @has foo/index.html '//a/@href' '../src/foo/src-links.rs.html'
#[path = "src-links/mod.rs"]
pub mod qux;
// @has foo/bar/index.html '//a/@href' '../../src/foo/src-links.rs.html'
pub mod bar {
/// Dox
// @has foo/bar/baz/index.html '//a/@href' '../../../src/foo/src-links.rs.html'
pub mod baz {
/// Dox
// @has foo/bar/baz/fn.baz.html '//a/@href' '../../../src/foo/src-links.rs.html'
pub fn baz() { }
}
/// Dox
// @has foo/bar/trait.Foobar.html '//a/@href' '../../src/foo/src-links.rs.html'
pub trait Foobar { fn dummy(&self) { } }
// @has foo/bar/struct.Foo.html '//a/@href' '../../src/foo/src-links.rs.html'
pub struct Foo { x: i32, y: u32 }
// @has foo/bar/fn.prawns.html '//a/@href' '../../src/foo/src-links.rs.html'
pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
}
/// Dox
// @has foo/fn.modfn.html '//a/@href' '../src/foo/src-links.rs.html'
pub fn modfn() { }
// same hierarchy as above, but just for the submodule
// @has src/foo/src-links/mod.rs.html
// @has foo/qux/index.html '//a/@href' '../../src/foo/src-links/mod.rs.html'
// @has foo/qux/bar/index.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
// @has foo/qux/bar/baz/index.html '//a/@href' '../../../../src/foo/src-links/mod.rs.html'
// @has foo/qux/bar/baz/fn.baz.html '//a/@href' '../../../../src/foo/src-links/mod.rs.html'
// @has foo/qux/bar/trait.Foobar.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
// @has foo/qux/bar/struct.Foo.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
// @has foo/qux/bar/fn.prawns.html '//a/@href' '../../../src/foo/src-links/mod.rs.html'
// @has foo/qux/fn.modfn.html '//a/@href' '../../src/foo/src-links/mod.rs.html'

View File

@ -0,0 +1,29 @@
// Copyright 2015 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.
//! Dox
pub mod bar {
/// Dox
pub mod baz {
/// Dox
pub fn baz() { }
}
/// Dox
pub trait Foobar { fn dummy(&self) { } }
pub struct Foo { x: i32, y: u32 }
pub fn prawns((a, b): (i32, u32), Foo { x, y }: Foo) { }
}
/// Dox
pub fn modfn() { }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_name = "foo"]
pub mod io {
pub trait Reader { fn dummy(&self) { } }
}

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![crate_name = "foo"]
pub trait MyTrait { fn dummy(&self) { } }
// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A> where A: MyTrait"