Skip to content

Commit

Permalink
Merge #61
Browse files Browse the repository at this point in the history
61: Use trybuild instead of compiletest r=taiki-e a=taiki-e

Refs: dtolnay/trybuild#13

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e authored Sep 26, 2019
2 parents bf1afc3 + f29daa6 commit f7b81de
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 121 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ auto_enums_core = { version = "=0.6.3", path = "core", default-features = false
auto_enums_derive = { version = "=0.6.3", path = "derive", default-features = false }

[dev-dependencies]
compiletest = { version = "=0.3.22", package = "compiletest_rs", features = ["stable", "tmp"] }
trybuild = "1.0"

[features]
# Default features.
Expand Down
9 changes: 2 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ jobs:
parameters:
toolchain: nightly
- script: |
cargo clean
cargo test -p auto_enums --all-features --test compiletest
env:
RUSTFLAGS: -Dwarnings --cfg compiletest
RUSTFLAGS='-Dwarnings --cfg compiletest' cargo test -p auto_enums --all-features --test compiletest
displayName: compiletest
- job: clippy
Expand Down Expand Up @@ -124,7 +121,5 @@ jobs:
parameters:
toolchain: nightly
- script: |
cargo doc --no-deps --all --all-features
env:
RUSTDOCFLAGS: -Dwarnings
RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all --all-features
displayName: cargo doc
3 changes: 2 additions & 1 deletion compiletest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
# . ./compiletest.sh
# ```

rm -rf target/debug/deps/libauto_enums* && RUSTFLAGS='--cfg compiletest' cargo +nightly test -p auto_enums --all-features --test compiletest
TRYBUILD=overwrite RUSTFLAGS='--cfg compiletest' cargo +nightly test -p auto_enums --all-features --test compiletest
# RUSTFLAGS='--cfg compiletest' cargo +nightly test -p auto_enums --all-features --test compiletest
29 changes: 4 additions & 25 deletions tests/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,9 @@
feature = "try_trait",
))]

use std::{env, path::PathBuf};

fn run_mode(mode: &'static str) {
let mut config = compiletest::Config::default();
config.mode = mode.parse().expect("invalid mode");
let mut me = env::current_exe().unwrap();
me.pop();
config.target_rustcflags = Some(format!(
"--edition=2018 \
-Z unstable-options \
--extern auto_enums \
-L {}",
me.display()
));
let src = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
config.src_base = src.join("tests").join(mode);

me.pop();
me.pop();
config.build_base = me.join("tests").join(mode);
compiletest::run_tests(&config);
}

#[test]
fn compiletest() {
run_mode("ui");
fn ui() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/auto_enum/*.rs");
t.compile_fail("tests/ui/enum_derive/*.rs");
}
3 changes: 0 additions & 3 deletions tests/ui/auto_enum/args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,3 @@ error: expected `,`
|
67 | #[auto_enum(marker = f t, Iterator)] //~ ERROR expected `,`
| ^

error: aborting due to 8 previous errors

3 changes: 0 additions & 3 deletions tests/ui/auto_enum/attribute.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ error: #[rec] has been removed and replaced with #[nested]
|
32 | #[rec] //~ ERROR #[rec] has been removed and replaced with #[nested]
| ^^^^^^

error: aborting due to 3 previous errors

2 changes: 0 additions & 2 deletions tests/ui/auto_enum/compile-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@ error[E0061]: this function takes 1 parameter but 2 parameters were supplied
| defined here
| expected 1 parameter

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0061`.
3 changes: 0 additions & 3 deletions tests/ui/auto_enum/marker.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ error: cannot find macro `marker` in this scope
|
29 | 2 => return marker!(1..9), //~ ERROR cannot find macro `marker!` in this scope
| ^^^^^^

error: aborting due to 2 previous errors

3 changes: 0 additions & 3 deletions tests/ui/auto_enum/rejected-by-rustc.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ help: try placing this code inside a block
|

error: `#[auto_enum]` is required two or more branches or marker macros in total, there is no branch or marker macro in this statement

error: aborting due to 2 previous errors

3 changes: 0 additions & 3 deletions tests/ui/enum_derive/args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ error: expected `,`
|
25 | #[enum_derive(Clone Foo)] //~ ERROR expected `,`
| ^^^

error: aborting due to 4 previous errors

3 changes: 0 additions & 3 deletions tests/ui/enum_derive/ty_impls.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ error: `enum_derive(Transpose)` all fields need to be generics
13 | | B(B),
14 | | }
| |_^

error: aborting due to previous error

3 changes: 0 additions & 3 deletions tests/ui/enum_derive/variant.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ error: cannot be implemented for enums with no variants
|
38 | enum Enum7 {} //~ ERROR cannot be implemented for enums with less than two variants
| ^^^^^^^^^^^^^

error: aborting due to 6 previous errors

24 changes: 0 additions & 24 deletions tests/ui/update-all-references.sh

This file was deleted.

40 changes: 0 additions & 40 deletions tests/ui/update-references.sh

This file was deleted.

0 comments on commit f7b81de

Please sign in to comment.