-
Notifications
You must be signed in to change notification settings - Fork 29
Revise revisions #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+565
−107
Merged
Revise revisions #33
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d5661e2
Add revision tests
oli-obk d78bdd1
Use inline revision annotation to test more cases
oli-obk 479c4ec
Require the `[revision]` before the `~` for patterns in preparation f…
oli-obk e3a5a5f
Allow multiple revisions per annotation
oli-obk bc8df25
Allow revisioning most commands
oli-obk bb0b946
documentation
oli-obk c4cd213
Add a new test that gets ignored on host
oli-obk 02412dc
Add test that should get ignored in one revision
oli-obk 5d2f849
Remove an unused string formatting
oli-obk 3ed1d68
Allow filtering revisions
oli-obk 76cd0a9
Add test for attempting to add revisions to the `revisions` command
oli-obk 84e3707
Special case the diagnostic for revised revisions
oli-obk 99106da
clippy
oli-obk 6f33d31
Split up long line
oli-obk da6f6b4
Update README
oli-obk ba2d33b
Move call out of the loop and replace filter-iteration with `retain`
oli-obk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -12,3 +12,7 @@ tempfile = "3.3.0" | |
[[test]] | ||
name = "ui_tests" | ||
harness = false | ||
|
||
[[test]] | ||
name = "ui_tests_bless" | ||
harness = false |
13 changes: 13 additions & 0 deletions
13
tests/integrations/basic-fail/tests/actual_tests_bless/revised_revision.rs
This file contains hidden or 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 @@ | ||
use basic_fail::add; | ||
//@[foo] revisions: foo bar | ||
|
||
#[cfg(foo)] | ||
fn main() { | ||
add("42", 3); //~[foo] ERROR: mismatched types | ||
} | ||
|
||
#[cfg(bar)] | ||
fn main() { | ||
add("42", 3); | ||
//~[bar]^ ERROR: mismatched types | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/integrations/basic-fail/tests/actual_tests_bless/revisions.bar.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions.rs:11:9 | ||
| | ||
11 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
17 changes: 17 additions & 0 deletions
17
tests/integrations/basic-fail/tests/actual_tests_bless/revisions.foo.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions.rs:6:9 | ||
| | ||
6 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
13 changes: 13 additions & 0 deletions
13
tests/integrations/basic-fail/tests/actual_tests_bless/revisions.rs
This file contains hidden or 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 @@ | ||
use basic_fail::add; | ||
//@ revisions: foo bar | ||
|
||
#[cfg(foo)] | ||
fn main() { | ||
add("42", 3); //~[foo] ERROR: mismatched types | ||
} | ||
|
||
#[cfg(bar)] | ||
fn main() { | ||
add("42", 3); | ||
//~[bar]^ ERROR: mismatched types | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_bad.bar.stderr
This file contains hidden or 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,9 @@ | ||
error[E0601]: `main` function not found in crate `revisions_bad` | ||
--> $DIR/revisions_bad.rs:10:2 | ||
| | ||
10 | } | ||
| ^ consider adding a `main` function to `$DIR/revisions_bad.rs` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0601`. |
17 changes: 17 additions & 0 deletions
17
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_bad.foo.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions_bad.rs:8:9 | ||
| | ||
8 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
10 changes: 10 additions & 0 deletions
10
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_bad.rs
This file contains hidden or 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,10 @@ | ||
#[cfg(foo)] | ||
use basic_fail::add; | ||
//@ revisions: foo bar | ||
//@[bar] error-pattern: `main` function not found in crate `revisions_bad` | ||
|
||
#[cfg(foo)] | ||
fn main() { | ||
add("42", 3); | ||
//~[foo]^ ERROR: mismatched types | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_filter.rs
This file contains hidden or 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,14 @@ | ||
use basic_fail::add; | ||
//@ignore-on-host | ||
//@ revisions: foo bar | ||
|
||
#[cfg(foo)] | ||
fn main() { | ||
add("42", 3); | ||
} | ||
|
||
#[cfg(bar)] | ||
fn main() { | ||
add("42", 3); | ||
//~[bar]^ ERROR: mismatched types | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_filter2.bar.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions_filter2.rs:12:9 | ||
| | ||
12 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
14 changes: 14 additions & 0 deletions
14
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_filter2.rs
This file contains hidden or 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,14 @@ | ||
use basic_fail::add; | ||
//@[foo] ignore-on-host | ||
//@ revisions: foo bar | ||
|
||
#[cfg(foo)] | ||
fn main() { | ||
add("42", 3); | ||
} | ||
|
||
#[cfg(bar)] | ||
fn main() { | ||
add("42", 3); | ||
//~[bar]^ ERROR: mismatched types | ||
} |
17 changes: 17 additions & 0 deletions
17
...grations/basic-fail/tests/actual_tests_bless/revisions_multiple_per_annotation.bar.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions_multiple_per_annotation.rs:5:9 | ||
| | ||
5 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
17 changes: 17 additions & 0 deletions
17
...grations/basic-fail/tests/actual_tests_bless/revisions_multiple_per_annotation.foo.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions_multiple_per_annotation.rs:5:9 | ||
| | ||
5 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
7 changes: 7 additions & 0 deletions
7
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_multiple_per_annotation.rs
This file contains hidden or 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,7 @@ | ||
use basic_fail::add; | ||
//@ revisions: foo bar | ||
|
||
fn main() { | ||
add("42", 3); | ||
//~[bar, foo]^ ERROR: mismatched types | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_same_everywhere.bar.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions_same_everywhere.rs:5:9 | ||
| | ||
5 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
17 changes: 17 additions & 0 deletions
17
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_same_everywhere.foo.stderr
This file contains hidden or 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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/revisions_same_everywhere.rs:5:9 | ||
| | ||
5 | add("42", 3); | ||
| --- ^^^^ expected `usize`, found `&str` | ||
| | | ||
| arguments to this function are incorrect | ||
| | ||
note: function defined here | ||
--> $DIR/tests/integrations/basic-fail/src/lib.rs:1:8 | ||
| | ||
1 | pub fn add(left: usize, right: usize) -> usize { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
7 changes: 7 additions & 0 deletions
7
tests/integrations/basic-fail/tests/actual_tests_bless/revisions_same_everywhere.rs
This file contains hidden or 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,7 @@ | ||
use basic_fail::add; | ||
//@ revisions: foo bar | ||
|
||
fn main() { | ||
add("42", 3); | ||
//~^ ERROR: mismatched types | ||
} |
This file contains hidden or 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,44 @@ | ||
use std::num::NonZeroUsize; | ||
use ui_test::*; | ||
|
||
fn main() -> ui_test::color_eyre::Result<()> { | ||
let path = "../../../target"; | ||
let mut config = Config { | ||
quiet: false, | ||
root_dir: "tests/actual_tests_bless".into(), | ||
dependencies_crate_manifest_path: Some("Cargo.toml".into()), | ||
output_conflict_handling: if std::env::var_os("BLESS").is_some() { | ||
OutputConflictHandling::Bless | ||
} else { | ||
OutputConflictHandling::Error | ||
}, | ||
// Make sure our tests are ordered for reliable output. | ||
num_test_threads: NonZeroUsize::new(1).unwrap(), | ||
..Config::default() | ||
}; | ||
config | ||
.dependency_builder | ||
.envs | ||
.push(("CARGO_TARGET_DIR".into(), path.into())); | ||
|
||
// hide binaries generated for successfully passing tests | ||
let tmp_dir = tempfile::tempdir()?; | ||
config.args.push("--out-dir".into()); | ||
config.args.push(tmp_dir.path().as_os_str().to_owned()); | ||
|
||
config.args.push("--edition=2021".into()); | ||
config.stderr_filter("in ([0-9]m )?[0-9\\.]+s", ""); | ||
config.stdout_filter("in ([0-9]m )?[0-9\\.]+s", ""); | ||
config.stderr_filter(r"[^ ]*/\.?cargo/registry/.*/", "$$CARGO_REGISTRY"); | ||
config.stderr_filter( | ||
&std::path::Path::new(path) | ||
.canonicalize() | ||
.unwrap() | ||
.parent() | ||
.unwrap() | ||
.display() | ||
.to_string(), | ||
"$$DIR", | ||
); | ||
ui_test::run_tests(config) | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.