From d3647fe81543f0a04a0d6aee15f4bb8c08774295 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 6 Apr 2015 13:49:30 -0700 Subject: [PATCH] test: Move all run-make rustdoc tests to test/rustdoc --- mk/tests.mk | 2 +- .../rustdoc-default-impl.rs} | 0 .../rustdoc-extern-default-method.rs} | 0 .../rustdoc-extern-method.rs} | 0 .../lib.rs => auxiliary/rustdoc-ffi.rs} | 0 .../run-make/rustdoc-assoc-types/Makefile | 5 -- .../run-make/rustdoc-default-impl/Makefile | 5 -- .../rustdoc-extern-default-method/Makefile | 6 -- .../run-make/rustdoc-extern-method/Makefile | 7 --- src/test/run-make/rustdoc-ffi/Makefile | 8 --- .../run-make/rustdoc-hidden-line/Makefile | 15 ----- src/test/run-make/rustdoc-must-use/Makefile | 5 -- .../run-make/rustdoc-negative-impl/Makefile | 5 -- src/test/run-make/rustdoc-recursion/Makefile | 11 ---- .../run-make/rustdoc-search-index/Makefile | 15 ----- src/test/run-make/rustdoc-smoke/Makefile | 4 -- src/test/run-make/rustdoc-src-links/Makefile | 5 -- src/test/run-make/rustdoc-src-links/foo.rs | 43 -------------- .../run-make/rustdoc-src-links/qux/mod.rs | 39 ------------- .../run-make/rustdoc-viewpath-self/Makefile | 5 -- src/test/run-make/rustdoc-where/Makefile | 5 -- .../lib.rs => rustdoc/assoc-types.rs} | 2 +- .../bar.rs => rustdoc/default-impl.rs} | 4 +- .../extern-default-method.rs} | 6 +- .../bar.rs => rustdoc/extern-method.rs} | 8 ++- .../rustdoc-ffi/user.rs => rustdoc/ffi.rs} | 11 +++- .../foo.rs => rustdoc/hidden-line.rs} | 4 +- .../lib.rs => rustdoc/must-use.rs} | 6 +- .../foo.rs => rustdoc/negative-impl.rs} | 8 +-- .../foo.rs => rustdoc/recursion1.rs} | 0 .../foo2.rs => rustdoc/recursion2.rs} | 0 .../foo3.rs => rustdoc/recursion3.rs} | 0 .../index.rs => rustdoc/search-index.rs} | 0 .../rustdoc-smoke/foo.rs => rustdoc/smoke.rs} | 15 +++-- src/test/rustdoc/src-links.rs | 56 +++++++++++++++++++ src/test/rustdoc/src-links/mod.rs | 29 ++++++++++ .../foo.rs => rustdoc/viewpath-self.rs} | 2 + .../rustdoc-where/foo.rs => rustdoc/where.rs} | 2 + 38 files changed, 125 insertions(+), 213 deletions(-) rename src/test/{run-make/rustdoc-default-impl/foo.rs => auxiliary/rustdoc-default-impl.rs} (100%) rename src/test/{run-make/rustdoc-extern-default-method/ext.rs => auxiliary/rustdoc-extern-default-method.rs} (100%) rename src/test/{run-make/rustdoc-extern-method/foo.rs => auxiliary/rustdoc-extern-method.rs} (100%) rename src/test/{run-make/rustdoc-ffi/lib.rs => auxiliary/rustdoc-ffi.rs} (100%) delete mode 100644 src/test/run-make/rustdoc-assoc-types/Makefile delete mode 100644 src/test/run-make/rustdoc-default-impl/Makefile delete mode 100644 src/test/run-make/rustdoc-extern-default-method/Makefile delete mode 100644 src/test/run-make/rustdoc-extern-method/Makefile delete mode 100644 src/test/run-make/rustdoc-ffi/Makefile delete mode 100644 src/test/run-make/rustdoc-hidden-line/Makefile delete mode 100644 src/test/run-make/rustdoc-must-use/Makefile delete mode 100644 src/test/run-make/rustdoc-negative-impl/Makefile delete mode 100644 src/test/run-make/rustdoc-recursion/Makefile delete mode 100644 src/test/run-make/rustdoc-search-index/Makefile delete mode 100644 src/test/run-make/rustdoc-smoke/Makefile delete mode 100644 src/test/run-make/rustdoc-src-links/Makefile delete mode 100644 src/test/run-make/rustdoc-src-links/foo.rs delete mode 100644 src/test/run-make/rustdoc-src-links/qux/mod.rs delete mode 100644 src/test/run-make/rustdoc-viewpath-self/Makefile delete mode 100644 src/test/run-make/rustdoc-where/Makefile rename src/test/{run-make/rustdoc-assoc-types/lib.rs => rustdoc/assoc-types.rs} (95%) rename src/test/{run-make/rustdoc-default-impl/bar.rs => rustdoc/default-impl.rs} (86%) rename src/test/{run-make/rustdoc-extern-default-method/lib.rs => rustdoc/extern-default-method.rs} (73%) rename src/test/{run-make/rustdoc-extern-method/bar.rs => rustdoc/extern-method.rs} (82%) rename src/test/{run-make/rustdoc-ffi/user.rs => rustdoc/ffi.rs} (64%) rename src/test/{run-make/rustdoc-hidden-line/foo.rs => rustdoc/hidden-line.rs} (94%) rename src/test/{run-make/rustdoc-must-use/lib.rs => rustdoc/must-use.rs} (81%) rename src/test/{run-make/rustdoc-negative-impl/foo.rs => rustdoc/negative-impl.rs} (63%) rename src/test/{run-make/rustdoc-recursion/foo.rs => rustdoc/recursion1.rs} (100%) rename src/test/{run-make/rustdoc-recursion/foo2.rs => rustdoc/recursion2.rs} (100%) rename src/test/{run-make/rustdoc-recursion/foo3.rs => rustdoc/recursion3.rs} (100%) rename src/test/{run-make/rustdoc-search-index/index.rs => rustdoc/search-index.rs} (100%) rename src/test/{run-make/rustdoc-smoke/foo.rs => rustdoc/smoke.rs} (74%) create mode 100644 src/test/rustdoc/src-links.rs create mode 100644 src/test/rustdoc/src-links/mod.rs rename src/test/{run-make/rustdoc-viewpath-self/foo.rs => rustdoc/viewpath-self.rs} (97%) rename src/test/{run-make/rustdoc-where/foo.rs => rustdoc/where.rs} (98%) diff --git a/mk/tests.mk b/mk/tests.mk index 29ffe55291f..bf30b7e50cd 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -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. diff --git a/src/test/run-make/rustdoc-default-impl/foo.rs b/src/test/auxiliary/rustdoc-default-impl.rs similarity index 100% rename from src/test/run-make/rustdoc-default-impl/foo.rs rename to src/test/auxiliary/rustdoc-default-impl.rs diff --git a/src/test/run-make/rustdoc-extern-default-method/ext.rs b/src/test/auxiliary/rustdoc-extern-default-method.rs similarity index 100% rename from src/test/run-make/rustdoc-extern-default-method/ext.rs rename to src/test/auxiliary/rustdoc-extern-default-method.rs diff --git a/src/test/run-make/rustdoc-extern-method/foo.rs b/src/test/auxiliary/rustdoc-extern-method.rs similarity index 100% rename from src/test/run-make/rustdoc-extern-method/foo.rs rename to src/test/auxiliary/rustdoc-extern-method.rs diff --git a/src/test/run-make/rustdoc-ffi/lib.rs b/src/test/auxiliary/rustdoc-ffi.rs similarity index 100% rename from src/test/run-make/rustdoc-ffi/lib.rs rename to src/test/auxiliary/rustdoc-ffi.rs diff --git a/src/test/run-make/rustdoc-assoc-types/Makefile b/src/test/run-make/rustdoc-assoc-types/Makefile deleted file mode 100644 index 74fca83f5f9..00000000000 --- a/src/test/run-make/rustdoc-assoc-types/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-default-impl/Makefile b/src/test/run-make/rustdoc-default-impl/Makefile deleted file mode 100644 index 338cf9d2053..00000000000 --- a/src/test/run-make/rustdoc-default-impl/Makefile +++ /dev/null @@ -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) diff --git a/src/test/run-make/rustdoc-extern-default-method/Makefile b/src/test/run-make/rustdoc-extern-default-method/Makefile deleted file mode 100644 index ffc4a08f801..00000000000 --- a/src/test/run-make/rustdoc-extern-default-method/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-extern-method/Makefile b/src/test/run-make/rustdoc-extern-method/Makefile deleted file mode 100644 index 55cbd2da6ae..00000000000 --- a/src/test/run-make/rustdoc-extern-method/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-ffi/Makefile b/src/test/run-make/rustdoc-ffi/Makefile deleted file mode 100644 index c312efe12f5..00000000000 --- a/src/test/run-make/rustdoc-ffi/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-hidden-line/Makefile b/src/test/run-make/rustdoc-hidden-line/Makefile deleted file mode 100644 index 3ac7b6d2fae..00000000000 --- a/src/test/run-make/rustdoc-hidden-line/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-must-use/Makefile b/src/test/run-make/rustdoc-must-use/Makefile deleted file mode 100644 index 74fca83f5f9..00000000000 --- a/src/test/run-make/rustdoc-must-use/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-negative-impl/Makefile b/src/test/run-make/rustdoc-negative-impl/Makefile deleted file mode 100644 index c1b1683efdb..00000000000 --- a/src/test/run-make/rustdoc-negative-impl/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-recursion/Makefile b/src/test/run-make/rustdoc-recursion/Makefile deleted file mode 100644 index ba971836e5a..00000000000 --- a/src/test/run-make/rustdoc-recursion/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-search-index/Makefile b/src/test/run-make/rustdoc-search-index/Makefile deleted file mode 100644 index e7e8f0c35a7..00000000000 --- a/src/test/run-make/rustdoc-search-index/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-smoke/Makefile b/src/test/run-make/rustdoc-smoke/Makefile deleted file mode 100644 index 7a1ad761b3d..00000000000 --- a/src/test/run-make/rustdoc-smoke/Makefile +++ /dev/null @@ -1,4 +0,0 @@ --include ../tools.mk -all: - $(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs - $(HTMLDOCCK) $(TMPDIR)/doc foo.rs diff --git a/src/test/run-make/rustdoc-src-links/Makefile b/src/test/run-make/rustdoc-src-links/Makefile deleted file mode 100644 index 419603e82f7..00000000000 --- a/src/test/run-make/rustdoc-src-links/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-src-links/foo.rs b/src/test/run-make/rustdoc-src-links/foo.rs deleted file mode 100644 index 9a964f11252..00000000000 --- a/src/test/run-make/rustdoc-src-links/foo.rs +++ /dev/null @@ -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 or the MIT license -// , 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() { } diff --git a/src/test/run-make/rustdoc-src-links/qux/mod.rs b/src/test/run-make/rustdoc-src-links/qux/mod.rs deleted file mode 100644 index 9b1563d32ac..00000000000 --- a/src/test/run-make/rustdoc-src-links/qux/mod.rs +++ /dev/null @@ -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 or the MIT license -// , 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() { } diff --git a/src/test/run-make/rustdoc-viewpath-self/Makefile b/src/test/run-make/rustdoc-viewpath-self/Makefile deleted file mode 100644 index c1b1683efdb..00000000000 --- a/src/test/run-make/rustdoc-viewpath-self/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-where/Makefile b/src/test/run-make/rustdoc-where/Makefile deleted file mode 100644 index c1b1683efdb..00000000000 --- a/src/test/run-make/rustdoc-where/Makefile +++ /dev/null @@ -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 diff --git a/src/test/run-make/rustdoc-assoc-types/lib.rs b/src/test/rustdoc/assoc-types.rs similarity index 95% rename from src/test/run-make/rustdoc-assoc-types/lib.rs rename to src/test/rustdoc/assoc-types.rs index 3e6e0ad5600..20076a76494 100644 --- a/src/test/run-make/rustdoc-assoc-types/lib.rs +++ b/src/test/rustdoc/assoc-types.rs @@ -10,7 +10,7 @@ #![crate_type="lib"] -// @has lib/trait.Index.html +// @has assoc_types/trait.Index.html pub trait Index { // @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized' type Output: ?Sized; diff --git a/src/test/run-make/rustdoc-default-impl/bar.rs b/src/test/rustdoc/default-impl.rs similarity index 86% rename from src/test/run-make/rustdoc-default-impl/bar.rs rename to src/test/rustdoc/default-impl.rs index 60a2f7202f8..0539ecae99d 100644 --- a/src/test/run-make/rustdoc-default-impl/bar.rs +++ b/src/test/rustdoc/default-impl.rs @@ -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; diff --git a/src/test/run-make/rustdoc-extern-default-method/lib.rs b/src/test/rustdoc/extern-default-method.rs similarity index 73% rename from src/test/run-make/rustdoc-extern-default-method/lib.rs rename to src/test/rustdoc/extern-default-method.rs index df92764dc9a..c40c46df9fe 100644 --- a/src/test/run-make/rustdoc-extern-default-method/lib.rs +++ b/src/test/rustdoc/extern-default-method.rs @@ -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; diff --git a/src/test/run-make/rustdoc-extern-method/bar.rs b/src/test/rustdoc/extern-method.rs similarity index 82% rename from src/test/run-make/rustdoc-extern-method/bar.rs rename to src/test/rustdoc/extern-method.rs index 26a05f8490f..ff92adf08c1 100644 --- a/src/test/run-make/rustdoc-extern-method/bar.rs +++ b/src/test/rustdoc/extern-method.rs @@ -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, _: ()); diff --git a/src/test/run-make/rustdoc-ffi/user.rs b/src/test/rustdoc/ffi.rs similarity index 64% rename from src/test/run-make/rustdoc-ffi/user.rs rename to src/test/rustdoc/ffi.rs index 09d7a7c536c..a720e39497d 100644 --- a/src/test/run-make/rustdoc-ffi/user.rs +++ b/src/test/rustdoc/ffi.rs @@ -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); +} diff --git a/src/test/run-make/rustdoc-hidden-line/foo.rs b/src/test/rustdoc/hidden-line.rs similarity index 94% rename from src/test/run-make/rustdoc-hidden-line/foo.rs rename to src/test/rustdoc/hidden-line.rs index 3906d9ee8ae..bb9eec793df 100644 --- a/src/test/run-make/rustdoc-hidden-line/foo.rs +++ b/src/test/rustdoc/hidden-line.rs @@ -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" diff --git a/src/test/run-make/rustdoc-must-use/lib.rs b/src/test/rustdoc/must-use.rs similarity index 81% rename from src/test/run-make/rustdoc-must-use/lib.rs rename to src/test/rustdoc/must-use.rs index cef79d4536b..e293675f5b0 100644 --- a/src/test/run-make/rustdoc-must-use/lib.rs +++ b/src/test/rustdoc/must-use.rs @@ -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), diff --git a/src/test/run-make/rustdoc-negative-impl/foo.rs b/src/test/rustdoc/negative-impl.rs similarity index 63% rename from src/test/run-make/rustdoc-negative-impl/foo.rs rename to src/test/rustdoc/negative-impl.rs index 6c56bcc9be6..aadabb15d1d 100644 --- a/src/test/run-make/rustdoc-negative-impl/foo.rs +++ b/src/test/rustdoc/negative-impl.rs @@ -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" +// @matches negative_impl/struct.Bravo.html '//pre' "pub struct Bravo" pub struct Bravo(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 !Send for Bravo" +// @matches negative_impl/struct.Bravo.html '//*[@class="impl"]//code' "impl !Send for Bravo" impl !Send for Bravo {} diff --git a/src/test/run-make/rustdoc-recursion/foo.rs b/src/test/rustdoc/recursion1.rs similarity index 100% rename from src/test/run-make/rustdoc-recursion/foo.rs rename to src/test/rustdoc/recursion1.rs diff --git a/src/test/run-make/rustdoc-recursion/foo2.rs b/src/test/rustdoc/recursion2.rs similarity index 100% rename from src/test/run-make/rustdoc-recursion/foo2.rs rename to src/test/rustdoc/recursion2.rs diff --git a/src/test/run-make/rustdoc-recursion/foo3.rs b/src/test/rustdoc/recursion3.rs similarity index 100% rename from src/test/run-make/rustdoc-recursion/foo3.rs rename to src/test/rustdoc/recursion3.rs diff --git a/src/test/run-make/rustdoc-search-index/index.rs b/src/test/rustdoc/search-index.rs similarity index 100% rename from src/test/run-make/rustdoc-search-index/index.rs rename to src/test/rustdoc/search-index.rs diff --git a/src/test/run-make/rustdoc-smoke/foo.rs b/src/test/rustdoc/smoke.rs similarity index 74% rename from src/test/run-make/rustdoc-smoke/foo.rs rename to src/test/rustdoc/smoke.rs index 494eb03d728..6ba7018bf22 100644 --- a/src/test/run-make/rustdoc-smoke/foo.rs +++ b/src/test/rustdoc/smoke.rs @@ -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) { } } diff --git a/src/test/rustdoc/src-links.rs b/src/test/rustdoc/src-links.rs new file mode 100644 index 00000000000..4d7dad64b47 --- /dev/null +++ b/src/test/rustdoc/src-links.rs @@ -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 or the MIT license +// , 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' diff --git a/src/test/rustdoc/src-links/mod.rs b/src/test/rustdoc/src-links/mod.rs new file mode 100644 index 00000000000..eb5e737b369 --- /dev/null +++ b/src/test/rustdoc/src-links/mod.rs @@ -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 or the MIT license +// , 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() { } diff --git a/src/test/run-make/rustdoc-viewpath-self/foo.rs b/src/test/rustdoc/viewpath-self.rs similarity index 97% rename from src/test/run-make/rustdoc-viewpath-self/foo.rs rename to src/test/rustdoc/viewpath-self.rs index 6fd47d84c30..65a981353f0 100644 --- a/src/test/run-make/rustdoc-viewpath-self/foo.rs +++ b/src/test/rustdoc/viewpath-self.rs @@ -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) { } } } diff --git a/src/test/run-make/rustdoc-where/foo.rs b/src/test/rustdoc/where.rs similarity index 98% rename from src/test/run-make/rustdoc-where/foo.rs rename to src/test/rustdoc/where.rs index 91a7e1c9fd4..3ce91d63300 100644 --- a/src/test/run-make/rustdoc-where/foo.rs +++ b/src/test/rustdoc/where.rs @@ -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 where A: MyTrait"