-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from compiletest_rs to trybuild
- Loading branch information
Showing
13 changed files
with
56 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error: Unknown literal value `` | ||
--> $DIR/deny_empty_default.rs:8:25 | ||
| | ||
8 | #[builder(default = "")] | ||
| ^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
warning: unused import: `Lorem` | ||
--> $DIR/private_build_fn.rs:23:21 | ||
| | ||
23 | use container::{Lorem, LoremBuilder}; | ||
| ^^^^^ | ||
| | ||
= note: `#[warn(unused_imports)]` on by default | ||
|
||
error[E0624]: method `build` is private | ||
--> $DIR/private_build_fn.rs:27:42 | ||
| | ||
27 | let lorem2 = LoremBuilder::default().build().unwrap(); | ||
| ^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0603]: struct `LoremBuilder` is private | ||
--> $DIR/private_builder.rs:17:18 | ||
| | ||
17 | let x = foo::LoremBuilder::default() | ||
| ^^^^^^^^^^^^ | ||
|
||
error[E0624]: method `build` is private | ||
--> $DIR/private_builder.rs:19:10 | ||
| | ||
19 | .build() | ||
| ^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
error[E0616]: field `dolor` of struct `inner::LoremBuilder` is private | ||
--> $DIR/private_fields.rs:25:5 | ||
| | ||
25 | lorem.dolor = Some(0); // <-- private | ||
| ^^^^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
derive_builder/tests/compile-fail/rename_setter_struct_level.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: Unknown field: `name` | ||
--> $DIR/rename_setter_struct_level.rs:7:18 | ||
| | ||
7 | #[builder(setter(name = "foo"))] | ||
| ^^^^ | ||
|
||
error[E0433]: failed to resolve: use of undeclared type or module `LoremBuilder` | ||
--> $DIR/rename_setter_struct_level.rs:14:13 | ||
| | ||
14 | let x = LoremBuilder::default() | ||
| ^^^^^^^^^^^^ use of undeclared type or module `LoremBuilder` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,10 @@ | ||
extern crate compiletest_rs as compiletest; | ||
|
||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
fn run_mode(mode: &'static str) { | ||
let base_dir = env!("CARGO_MANIFEST_DIR"); | ||
|
||
let test_dir = PathBuf::from(format!("{}/tests/{}", base_dir, mode)); | ||
|
||
if !test_dir.is_dir() { | ||
panic!("Directory does not exist: {:?}", test_dir); | ||
} | ||
|
||
let mut config = compiletest::Config::default(); | ||
let cfg_mode = mode.parse().ok().expect("Invalid mode"); | ||
|
||
config.mode = cfg_mode; | ||
config.src_base = test_dir; | ||
config.link_deps(); | ||
config.clean_rmeta(); | ||
|
||
compiletest::run_tests(&config); | ||
} | ||
extern crate trybuild; | ||
extern crate rustversion; | ||
|
||
#[rustversion::stable(1.40)] | ||
#[test] | ||
fn compile_test() { | ||
run_mode("run-pass"); | ||
run_mode("compile-fail"); | ||
let t = trybuild::TestCases::new(); | ||
t.pass("tests/run-pass/*.rs"); | ||
t.compile_fail("tests/compile-fail/*.rs"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters