350 Commits

Author SHA1 Message Date
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
Eh2406
7fc0dffed2 remove all of the (now) unnecessary temp file usage in tests 2018-07-26 15:10:48 -04: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
5659b78b76
Replace const BASIC_MANIFEST with basic_manifest("foo", "0.0.1") 2018-07-24 23:35:50 +01:00
Dale Wijnand
081e7930d2
Drop now unnecessary basic manifests 2018-07-24 16:33:55 +01:00
Dale Wijnand
d2c815be22
Add an opt-out to the auto-generated Cargo.toml 2018-07-24 13:19:47 +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
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
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
Alex Crichton
b02ba3771e Import cargo fix directly in to Cargo
This commit imports the `cargo fix` subcommand in rust-lang-nursery/rustfix
directly into Cargo as a subcommand. This should allow us to ease our
distribution story of `cargo fix` as we prepare for the upcoming 2018 edition
release.

It's been attempted here to make the code as idiomatic as possible for Cargo's
own codebase. Additionally all tests from cargo-fix were imported into Cargo's
test suite as well. After this lands and is published in nightly the `cargo-fix`
command in rust-lang-nursery/rustfix will likely be removed.

cc rust-lang/rust#52272
2018-07-16 21:58:58 -07:00
Eric Huss
ad3bab1fc4 Fix random errors in test compiler_json_error_format. 2018-06-23 15:51:22 -07:00
debris
66aa9bff66 extracted duplicated chunk of code into fn emit_build_output, removed redundant line from compiler_json_error_format test 2018-06-04 10:03:13 +02:00
debris
f101d88ebd fixed #5602, expose cached build script output in json output 2018-06-03 17:09:44 +02:00
Eduard-Mihai Burtescu
62faec8511
Remove -Zno-trans test. 2018-05-15 10:14:03 +03:00
Aleksey Kladov
ecd1e5df0f Tweak error messages
By convention, all errors should start with a lowercase letter
2018-05-03 18:31:23 +03:00
Simon Smith
0b530c3086 Add target directory parameter: address suggestions 2018-04-24 02:52:41 -04:00
Simon Smith
dd0b7a2cda Add target directory parameter --target-dir 2018-04-23 18:23:48 -04:00
Aleksey Kladov
14067b952e Remove some is_nightly checks from tests 2018-04-22 18:08:31 +03:00
Dale Wijnand
e471745e47
Introduce autoXXX keys for target auto-discovery
In Rust 2015 absence of the configuration makes it default to not
include auto-discovered targets (i.e false), with a warnings message.

In Rust 2018 absence makes it default to include auto-discovered
targets (i.e true).

Fixes #5330
2018-04-20 20:57:24 +01:00
Eric Huss
e7896a2f68 Fix with_*_does_not_contain to support [..] and macro matching. 2018-04-18 22:13:30 -07:00
Bastien Orivel
8daf81e193 Replace tempdir by tempfile
The former has been deprecated in favor of the latter
2018-03-26 13:29:02 +02:00
bors
b0a2252063 Auto merge of #5186 - infinity0:stricter-need-dev-deps, r=alexcrichton
Stricter need_dev_deps behaviour

The previous PR (#5012) contained an unnecessary work-around for behaviour of `--all-targets` that was misunderstood. This PR removes that work-around and adds some tests and comments to clarify the behaviour for future contributors, which may help to make easier a future fix for #5177 and #5178.
2018-03-21 14:19:11 +00:00
bors
4dde7264b5 Auto merge of #5204 - lukaslueg:issue5199, r=alexcrichton
Do not allow crate-type or proc-macro for [[bin]]-targets

Fixes #5199

This simply disallows `proc-macro` and `crate-type` to be set to anything for binary targets. Is this the best way to go or does a warning about the unused setting suffice?
2018-03-21 13:56:00 +00:00
Alex Crichton
0deaae9e52 Don't require cargo update when bumping versions
One historical annoyance I've always had with Cargo that I've found surprising
is that in some situations when you bump version numbers you'll have to end up
running `cargo update` later on to get everything to build. You get pretty wonky
error messages in this case as well saying a package doesn't exist when it
clearly does at a particular location!

I've had difficulty historically nailing down a test case for this but it looks
like we ironically already had one in our test suite and I also jury-rigged up
one from a case I ran into in the wild today.
2018-03-20 12:05:33 -07:00
Lukas Lueg
257c23323d Do not allow crate-type or proc-macro for [[bin]]-targets
in the current workspace.

Fixes #5199.
2018-03-20 16:51:03 +01:00
Ximin Luo
0bc1155753 Split tests, apparently cargo clean does not work well on windows 2018-03-19 18:20:54 +01:00
Aleksey Kladov
e5971b935c Slightly improve ergonomics of writing Cargo tests 2018-03-17 00:08:23 +03:00
Ximin Luo
0bf8e541db Add tests for --all-targets 2018-03-15 17:08:40 +01:00
Ximin Luo
89d274875f Revert "Work around #5134 for now"
This reverts commit d46db71b3ff17dfc0f4be6308c8b94613d65a572.
2018-03-15 17:05:13 +01:00
Aleksey Kladov
b0c181d91c Prettify rustfmted single-line strings 2018-03-14 17:48:44 -07:00
Alex Crichton
1e6828485e cargo fmt 2018-03-14 17:48:23 -07:00
Aleksey Kladov
f930609404 Don't check for filenames in message-format tests
Depending on the OS, there might be an additional artifacts for
debuginfo (dSYM folder for macs, .pbd file for windows). Given that we
can't disable `.pdb` for windows[1], let's just ignore all filenames!

[1]: https://github.com/rust-lang/rust/pull/28505)
2018-03-15 00:37:26 +03:00
Aleksey Kladov
9c0d3f2980 Copy .pdb files to target directory
`.pdb` files are for windows debug info (unlike on linux, debug info is
in a separate file). Windows executable actually hard-code paths to
`.pdb` files, so debugging mvsc rust programs works even without this
patch. However, if you want to distribute the executable to other
machines, you'd better distribute both `foo.exe` and `foo.pdb`, because
absolute paths won't work on another machine. Having same-named .pdb
file alongside the binary would work though.

closes #4960
2018-03-14 22:31:19 +03:00
bors
3cfb23bc56 Auto merge of #5152 - matklad:clap, r=alexcrichton
Clap

Reopening of #5129

So, looks like all tests are 🍏 on my machine!

I definitely want to refactor it some more, and also manually checked that we haven't regressed any help messages, but all the major parts are in place already.
2018-03-13 14:46:45 +00:00
Aleksey Kladov
a64df78ea6 Relax tests for windows
On windows, clap prints `cargo.exe` rather than just `cargo`.
2018-03-10 18:46:32 +03:00
bors
d147e10374 Auto merge of #5126 - gilescope:cycle-error-message, r=alexcrichton
Error message for package "depends on itself" lists the packages in the cycle.

I got a cycle while trying to build someone else's code and cargo's error message didn't point me in the right direction, just mentioned there was a cycle. I thought we could be a bit more helpful.

Don't know what you think of {:#?} as the display but it seemed minimal code so I thought I'd start with that. I could compress the output to one package per line if preferred.
2018-03-09 19:40:03 +00:00
Aleksey Kladov
67968e6b0e Validate that jobs argument is a number 2018-03-09 11:05:47 +03:00
Aleksey Kladov
31ea0d93f7 Fix some trivially fixable tests 2018-03-08 23:31:56 +03:00
Aleksey Kladov
178b16d12b Temporarly ignore some tests 2018-03-08 23:30:46 +03:00
Giles Cope
74deb8c96d Switch to exhaustive matches in tests. 2018-03-08 18:37:30 +00:00
Giles Cope
32c7ac144b As pointed out by Jacob, we can display the ordered cycle in the error message. 2018-03-07 22:56:47 +00:00
Ximin Luo
d46db71b3f Work around #5134 for now 2018-03-07 14:46:43 +01:00
Giles Cope
3cd7708774 Neater error message. Tests now check the cycle is output. 2018-03-06 09:30:37 +00:00
Giles Cope
2ee2741e80 Error message for package cycles lists the packages in the cycle. 2018-03-06 00:41:21 +00:00
Ximin Luo
9c5eecd419 Merge remote-tracking branch 'upstream/master' into pr4988 2018-03-03 12:56:08 +01:00
Timothy Bess
05b896ac90 Issue #5087
* targeted error message for virtual manifests
* assert correct error message
2018-02-28 16:43:08 -05:00
Timothy Bess
68a681ff03 Issue #5087
* remove Workspace::current_manifest
* remove incorrect logging
* move empty check to Packages::into_package_id_specs
* add test case mentioned in issue
2018-02-27 21:37:40 -05:00
Eh2406
68a40ad42b Merge remote-tracking branch 'origin/master' into links 2018-02-21 15:41:48 -05:00
André Rocha
c2ff988c9f Reorganize integration tests as one crate with many modules. Issue #4867. 2018-02-21 13:33:51 -05:00