Commit graph

55 commits

Author SHA1 Message Date
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 81a7f472ed
lang items need feature gates 2018-10-16 11:52:48 +02:00
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 4da662d2be
Future proof an unstable test
statics (even extern ones) will get their type checked for a `Sized` bound in order to fix https://github.com/rust-lang/rust/issues/54410
2018-10-15 20:45:39 +02:00
Joel Gallant 2e9ea1e21c Fixes doc::doc_edition test output (too many spaces) 2018-09-20 16:09:55 -06:00
Joel Gallant 27c49ae015 Fixes verbose output tests 2018-09-20 14:55:09 -06:00
Guillaume Gomez 7b9255405f Add possibility to remove process exit code 2018-09-14 23:06:17 +02:00
Guillaume Gomez 9dcee5d663 Remove error code check in doc test 2018-09-14 23:05:35 +02:00
Eric Huss 1ef954ea1b Fix --document-private-items for multiple targets.
Closes #5958.
2018-09-13 06:19:35 -07:00
Zach Lute b020d3789a Resolve merge conflicts with test string changes. 2018-09-09 16:48:57 -07:00
Dale Wijnand d0679c7f8e
Specify crates.io is the default registry & print index 2018-09-08 09:25:41 +01:00
Zach Lute 89f43938fe Print file paths instead of file:// URLs.
This change ensures cargo will output file paths in the expected format
(C:\foo\... on Windows, /foo/... elsewhere). Previously it would output
file:// URLs instead.

To support this change, additional changes were made to the test suite
string processing such that [ROOT] is now replaced with the appropriate
file path root for the platform.

The CWD template was also updated to use [CWD] like other replacement
templates and to do the replacement on the expected value rather than
the actual value to avoid replacing things we don't expect with CWD.
2018-09-07 19:42:59 -07:00
Matthias Krüger 2cd9cce6e3 clippy: resolve all warnings about useless format!() 2018-09-03 11:38:29 +02:00
Dale Wijnand d5fc8dc3a7
Introduce the CWD macro in test output asserting
Avoids dealing with things like CWD changing.
2018-08-30 11:05:29 +02:00
Dale Wijnand 570fe8927d
Remove hamcrest existing_file() 2018-08-29 10:26:12 +02:00
Dale Wijnand 6fd1b54c65
Remove hamcrest existing_dir() 2018-08-29 07:53:01 +02:00
Dale Wijnand a173fc0abe
Replace .exec_with_output() usage with .with_stdout_contains 2018-08-29 00:45:19 +02:00
Dale Wijnand 85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand b5ee3635ef
Wrap ProcessBuilder in Execs & make .cargo return that 2018-08-28 09:24:37 +01:00
Dale Wijnand 0152f26405
Move .env/.masquerade_as_nightly_cargo to collapse some more p.cargo calls 2018-08-18 21:34:09 +01:00
Dale Wijnand 511d4bc503
Collapse multiline ProcessBuilder::arg calls in tests
.. by calling this a bunch of times:

    fastmod --multiline '\.cargo\("([^"]+)"\).[ ]+\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/
2018-08-18 15:12:54 +01:00
Dale Wijnand af4f1392f7
Collapse ProcessBuilder::arg calls in tests
.. with mutliple calls of:

    fastmod --accept-all '\.cargo\("([^"]+)"\)\.arg\("([^"]+)"\)' '.cargo("${1} ${2}")' tests/testsuite/

until no changes are left.
2018-08-18 15:05:45 +01:00
Dale Wijnand 3fdec5a2c6
Resolve a const_static_lifetime lint warning 2018-08-13 11:10:44 +01:00
bors ae97799980 Auto merge of #5876 - matthiaskrgr:clippy_2, r=alexcrichton
fix a bunch of clippy warnings

 (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )
2018-08-12 22:42:53 +00:00
Matthias Krüger 8798bf0d28 fix a bunch of clippy warnings (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )
Special thanks to dwijnand for helping me with this! :)
2018-08-12 10:00:12 +02:00
Dale Wijnand 2c704d8841
Add a test for "cargo doc --message-format=short" 2018-08-10 08:49:15 +01:00
Eric Huss c28823fa00 Update for review comments. 2018-08-09 15:43:34 -07:00
Eric Huss f3faa976fa Support JSON with rustdoc.
This allows `cargo doc --message-format=json` to actually work.

Note that this explicitly does not attempt to support it for doctests for
several reasons:
- `rustdoc --test --error-format=json` does not work for some reason.
- Since the lib is usually compiled before running rustdoc, warnings/errors
  will be emitted correctly by rustc.
- I'm unaware of any errors/warnings `rustdoc --test` is capable of producing
  assuming the code passed `rustc`.
- The compilation of the tests themselves do not support JSON.
- libtest does not output json, so it's utility is limited.
2018-08-08 23:59:07 -07:00
Dale Wijnand 16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Dale Wijnand 05400b8018
Drop the [/] test output macro 2018-08-02 10:18:48 +01:00
Dale Wijnand 67c52ffe58
Add tests for per-target edition
Test:
* enabling edition feature & setting at target level (happy path)
* overriding the package-level edition with per-target edition
* feature gating of per-target edition
* per-target edition usage for rustdoc
2018-07-31 14:49:33 +01:00
Dale Wijnand ca7d9ee292
Declare one-line files on one line, in test projects 2018-07-25 09:58:50 +01:00
Dale Wijnand ab19c48358
Dedup a bunch more manifest 2018-07-25 00:43:30 +01:00
Dale Wijnand 081e7930d2
Drop now unnecessary basic manifests 2018-07-24 16:33:55 +01:00
Dale Wijnand 43b42d6f4c
Reorganise the testsuite crate module hierarchy
* Collapse the nested cargotest::support module into the cargotest
  module (merge the mod.rs's)
* Rename the cargotest module to support
* Nest the top-level hamcrest module into support
2018-07-22 08:46:44 +01:00
Eric Huss c3b477d495 Support --cap-lints in rustdoc. 2018-07-21 20:17:03 -07:00
Dale Wijnand f8c9928cc1
Rework some test projects to use the "foo" default
Generally that means either switching "foo" and "bar" around (reversing
the arrow), or it means push "foo" to "bar" (and sometimes "bar" to
"baz", etc..) to free up "foo".

For trivia that leaves 80/1222 outliers, therefore 93.4% of test
project use the default. :)
2018-07-21 19:40:45 +01:00
Dale Wijnand 6da2ada26d
Migrate trailing calls to project with an argument
.. in docs, commented code & tests targetting non-macos.
2018-07-20 15:25:51 +01:00
Dale Wijnand 7fe2fbc8a3
Remove the argument from the project test support function
By rewriting the tests, with rerast (https://github.com/google/rerast),
to use the newly introduced "at" method.

First I added the following temporary function to cargotest::support:

    pub fn project_foo() -> ProjectBuilder {
        project("foo")
    }

Then I defined the following rewrite.rs:

    use cargotest::support::{ project, project_foo };

    fn rule1(a: &'static str) {
        replace!(project("foo") => project_foo());
        replace!(project(a) => project_foo().at(a));
    }

Then I ran rerast:

    cargo +nightly rerast --rules_file=rewrite.rs --force --targets tests --file tests/testsuite/main.rs

Finally I searched and replaced the references to project_foo with
argument-less project (a little awkardly on macOS with a git clean).

    find tests -type f -exec sed -i -e 's/project_foo/project/g' {} +
    git clean -d tests
2018-07-20 13:31:50 +01:00
bors 06721dd6b6 Auto merge of #5543 - roblabla:doc-private-items, r=alexcrichton
Add document-private-items flag to cargo doc

Add a `--document-private-items` flag to `cargo doc`, that mimics the equivalent `cargo rustdoc -- --document-private-items`. This works by relaying the flag to the underlying rustdoc call.
2018-07-16 00:26:07 +00:00
roblabla 7757753b28 Verify that private items were actually documented 2018-07-15 20:22:22 +02:00
roblabla 4a11afc59f Add a test for document-private-items 2018-07-15 20:10:01 +02:00
Esteve Fernandez 1286b841e9 Disable cargo doc --open tests on Windows and macOS. 2018-05-29 12:34:31 +02:00
Esteve Fernandez a0cf04e066 Added two more tests: one where a package contains a library and a binary and another where it only contains a binary. 2018-05-29 12:23:50 +02:00
Esteve Fernandez 8f3be0626f Use [/] instead of hardcoded / so that it's portable on Windows. 2018-05-29 12:05:41 +02:00
Esteve Fernandez 2309420106 Don't pass --open as an argument. 2018-05-29 12:05:36 +02:00
Esteve Fernandez 3d63b12f7c Added test where the name of the library is different from the package's. 2018-05-29 11:55:29 +02:00
Eric Huss 3dbae343ac Fix passing --edition to rustdoc during doctests.
Fixes #5538
2018-05-15 09:29:34 -07:00
Alex Crichton 8413008937 Rename the rust manifest key to edition
This'll hopefully jive better with the terminology of "edition" throughout the
rest of Rust!
2018-05-03 11:45:04 -07:00
Eric Huss 575d6e819c Profile Overrides (RFC #2282 Part 1) 2018-04-27 13:22:00 -07:00
varkor 97b971a775 Update tests to check for Checking 2018-04-19 19:19:11 +01:00
Richard Dodd 066f9a02c9 Better test description 2018-04-15 14:00:36 +01:00