add tests for behavior in rfc#3662

* Adds tests for the behavior from rfc#3662 in `tests/rustdoc/`
This commit is contained in:
EtomicBomb 2024-09-07 19:02:22 -04:00
parent 2e1cba6415
commit 548b6e197d
41 changed files with 501 additions and 0 deletions

View File

@ -0,0 +1,5 @@
//@ doc-flags:--merge=shared
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,8 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=shared
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,25 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=shared
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has index.html '//ul[@class="all-items"]//a[@href="sierra/index.html"]' 'sierra'
//@ has index.html '//ul[@class="all-items"]//a[@href="tango/index.html"]' 'tango'
//@ has quebec/struct.Quebec.html
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Tango'
//@ hasraw search-index.js 'Sierra'
//@ hasraw search-index.js 'Quebec'
// similar to cargo-workflow-transitive, but we use --merge=read-write,
// which is the default.
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,7 @@
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,10 @@
//@ aux-build:sierra.rs
//@ build-aux-docs
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/romeo
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate sierra;
pub type Romeo = sierra::Sierra;

View File

@ -0,0 +1,11 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/sierra
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,10 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/tango
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,35 @@
//@ aux-build:tango.rs
//@ aux-build:romeo.rs
//@ aux-build:quebec.rs
//@ aux-build:sierra.rs
//@ build-aux-docs
//@ doc-flags:--merge=finalize
//@ doc-flags:--include-parts-dir=info/doc.parts/tango
//@ doc-flags:--include-parts-dir=info/doc.parts/romeo
//@ doc-flags:--include-parts-dir=info/doc.parts/quebec
//@ doc-flags:--include-parts-dir=info/doc.parts/sierra
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html '//h1' 'List of all crates'
//@ has index.html
//@ has index.html '//ul[@class="all-items"]//a[@href="indigo/index.html"]' 'indigo'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has index.html '//ul[@class="all-items"]//a[@href="romeo/index.html"]' 'romeo'
//@ has index.html '//ul[@class="all-items"]//a[@href="sierra/index.html"]' 'sierra'
//@ has index.html '//ul[@class="all-items"]//a[@href="tango/index.html"]' 'tango'
//@ !has quebec/struct.Quebec.html
//@ !has romeo/type.Romeo.html
//@ !has sierra/struct.Sierra.html
//@ !has tango/trait.Tango.html
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Quebec'
//@ hasraw search-index.js 'Romeo'
//@ hasraw search-index.js 'Sierra'
//@ hasraw search-index.js 'Tango'
//@ has type.impl/sierra/struct.Sierra.js
//@ hasraw type.impl/sierra/struct.Sierra.js 'Tango'
//@ hasraw type.impl/sierra/struct.Sierra.js 'Romeo'
// document everything in the default mode, there are separate out
// directories that are linked together

View File

@ -0,0 +1,6 @@
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,9 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,17 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=none
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ !has index.html
//@ has sierra/struct.Sierra.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ !has trait.impl/tango/trait.Tango.js
//@ !has search-index.js
// we don't generate any cross-crate info if --merge=none, even if we
// document crates separately
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,6 @@
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,9 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/tango
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,18 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/sierra
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ !has index.html
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ !has trait.impl/tango/trait.Tango.js
//@ !has search-index.js
// we --merge=none, so --parts-out-dir doesn't do anything
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,6 @@
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,9 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/tango
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,22 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=finalize
//@ doc-flags:--include-parts-dir=info/doc.parts/tango
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has quebec/struct.Quebec.html
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Tango'
//@ hasraw search-index.js 'Sierra'
//@ !hasraw search-index.js 'Quebec'
// we overwrite quebec and tango's cross-crate information, but we
// include the info from tango meaning that it should appear in the out
// dir
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,7 @@
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,10 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ unique-doc-out-dir
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/tango
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,25 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=finalize
//@ doc-flags:--include-parts-dir=info/doc.parts/tango
//@ doc-flags:--include-parts-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has index.html '//ul[@class="all-items"]//a[@href="sierra/index.html"]' 'sierra'
//@ has index.html '//ul[@class="all-items"]//a[@href="tango/index.html"]' 'tango'
//@ has sierra/struct.Sierra.html
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Tango'
//@ hasraw search-index.js 'Sierra'
//@ hasraw search-index.js 'Quebec'
// If these were documeted into the same directory, the info would be
// overwritten. However, since they are merged, we can still recover all
// of the cross-crate information
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,5 @@
//@ doc-flags:--merge=none
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,8 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=finalize
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,20 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=shared
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has quebec/struct.Quebec.html
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Tango'
//@ hasraw search-index.js 'Sierra'
//@ !hasraw search-index.js 'Quebec'
// since tango is documented with --merge=finalize, we overwrite q's
// cross-crate information
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,13 @@
//@ doc-flags:--merge=finalize
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has quebec/struct.Quebec.html
//@ hasraw search-index.js 'Quebec'
// there is nothing to read from the output directory if we use a single
// crate
pub struct Quebec;

View File

@ -0,0 +1,12 @@
//@ doc-flags:--merge=shared
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has quebec/struct.Quebec.html
//@ hasraw search-index.js 'Quebec'
// read-write is the default and this does the same as `single-crate`
pub struct Quebec;

View File

@ -0,0 +1,13 @@
//@ doc-flags:--parts-out-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has quebec/struct.Quebec.html
//@ hasraw search-index.js 'Quebec'
// we can --parts-out-dir, but that doesn't do anything other than create
// the file
pub struct Quebec;

View File

@ -0,0 +1,11 @@
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ !has index.html
//@ has quebec/struct.Quebec.html
//@ !has search-index.js
// --merge=none doesn't write anything, despite --parts-out-dir
pub struct Quebec;

View File

@ -0,0 +1,5 @@
//@ doc-flags:--merge=finalize
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,8 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=finalize
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,20 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=finalize
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="sierra/index.html"]' 'sierra'
//@ has index.html '//ul[@class="all-items"]//a[@href="tango/index.html"]' 'tango'
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Sierra'
// write only overwrites stuff in the output directory
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,6 @@
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,9 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=none
//@ doc-flags:--parts-out-dir=info/doc.parts/tango
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,27 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=finalize
//@ doc-flags:--include-parts-dir=info/doc.parts/tango
//@ doc-flags:--include-parts-dir=info/doc.parts/quebec
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has index.html '//ul[@class="all-items"]//a[@href="sierra/index.html"]' 'sierra'
//@ has index.html '//ul[@class="all-items"]//a[@href="tango/index.html"]' 'tango'
//@ has quebec/struct.Quebec.html
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Tango'
//@ hasraw search-index.js 'Sierra'
//@ hasraw search-index.js 'Quebec'
// We avoid writing any cross-crate information, preferring to include it
// with --include-parts-dir.
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,5 @@
//@ doc-flags:--merge=finalize
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,8 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=shared
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,25 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=shared
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ has index.html
//@ has index.html '//h1' 'List of all crates'
//@ has index.html '//ul[@class="all-items"]//a[@href="quebec/index.html"]' 'quebec'
//@ has index.html '//ul[@class="all-items"]//a[@href="sierra/index.html"]' 'sierra'
//@ has index.html '//ul[@class="all-items"]//a[@href="tango/index.html"]' 'tango'
//@ has quebec/struct.Quebec.html
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ hasraw trait.impl/tango/trait.Tango.js 'struct.Sierra.html'
//@ hasraw search-index.js 'Tango'
//@ hasraw search-index.js 'Sierra'
//@ hasraw search-index.js 'Quebec'
// We can use read-write to emulate the default behavior of rustdoc, when
// --merge is left out.
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,5 @@
//@ doc-flags:--merge=none
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
pub struct Quebec;

View File

@ -0,0 +1,8 @@
//@ aux-build:quebec.rs
//@ build-aux-docs
//@ doc-flags:--merge=none
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
extern crate quebec;
pub trait Tango {}

View File

@ -0,0 +1,17 @@
//@ aux-build:tango.rs
//@ build-aux-docs
//@ doc-flags:--merge=none
//@ doc-flags:--enable-index-page
//@ doc-flags:-Zunstable-options
//@ !has index.html
//@ has sierra/struct.Sierra.html
//@ has tango/trait.Tango.html
//@ hasraw sierra/struct.Sierra.html 'Tango'
//@ !has trait.impl/tango/trait.Tango.js
//@ !has search-index.js
// --merge=none on all crates does not generate any cross-crate info
extern crate tango;
pub struct Sierra;
impl tango::Tango for Sierra {}

View File

@ -0,0 +1,5 @@
//@ unique-doc-out-dir
//@ doc-flags:--parts-out-dir=info/doc.parts/foxtrot
//@ doc-flags:-Zunstable-options
pub trait Foxtrot {}

View File

@ -0,0 +1,16 @@
//@ aux-build:foxtrot.rs
//@ build-aux-docs
//@ doc-flags:--include-parts-dir=info/doc.parts/foxtrot
//@ doc-flags:-Zunstable-options
//@ has echo/enum.Echo.html
//@ hasraw echo/enum.Echo.html 'Foxtrot'
//@ hasraw trait.impl/foxtrot/trait.Foxtrot.js 'enum.Echo.html'
//@ hasraw search-index.js 'Foxtrot'
//@ hasraw search-index.js 'Echo'
// document two crates in different places, and merge their docs after
// they are generated
extern crate foxtrot;
pub enum Echo {}
impl foxtrot::Foxtrot for Echo {}