From f934f98111591c3d43aa4698648671fed312ccc1 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Fri, 8 Feb 2019 08:05:52 +0100 Subject: [PATCH] Add a uitest subcommand to simplify UI test invocation This allows to run `TESTNAME=xxx cargo uitest` instead of `TESTNAME=xxx cargo test --test-compile-test` --- .cargo/config | 2 ++ CONTRIBUTING.md | 4 ++-- clippy_lints/src/utils/author.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 00000000000..7cb41d979a6 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,2 @@ +[alias] +uitest = "test --test compile-test" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5619ee00f8d..7ae8f3936a4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -101,7 +101,7 @@ fn main() { } ``` -Now you run `TESTNAME=ui/my_lint cargo test --test compile-test` to produce +Now you run `TESTNAME=ui/my_lint cargo uitest` to produce a `.stdout` file with the generated code: ```rust @@ -151,7 +151,7 @@ Use `cargo test` to run the whole testsuite. If you don't want to wait for all tests to finish, you can also execute a single test file by using `TESTNAME` to specify the test to run: ```bash -TESTNAME=ui/empty_line_after_outer_attr cargo test --test compile-test +TESTNAME=ui/empty_line_after_outer_attr cargo uitest ``` Clippy uses UI tests. UI tests check that the output of the compiler is exactly as expected. diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 264a5463225..4e2d4de8518 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -25,7 +25,7 @@ use syntax::ast::{Attribute, LitKind, DUMMY_NODE_ID}; /// } /// ``` /// -/// Running `TESTNAME=ui/my_lint cargo test --test compile-test` will produce +/// Running `TESTNAME=ui/my_lint cargo uitest` will produce /// a `./tests/ui/new_lint.stdout` file with the generated code: /// /// ```rust