Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

### Fixed

### Changed

- when a test file has no error patterns, there's now a suggestion to add `//@check-pass`

## [0.30.4] - 2025-11-24

### Added
Expand Down
9 changes: 5 additions & 4 deletions src/status_emitter/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ fn print_error(error: &Error, path: &Path) {
format!("`{s}` not found in diagnostics {line}")
}
Pattern::Regex(r) => {
format!("`/{r}/` does not match diagnostics {line}",)
format!("`/{r}/` does not match diagnostics {line}")
}
};
// This will print a suitable error header.
Expand All @@ -671,9 +671,9 @@ fn print_error(error: &Error, path: &Path) {
code,
expected_line,
} => {
let line = match expected_line {
Some(line) => format!("on line {line}"),
None => format!("outside the testfile"),
let line: Cow<_> = match expected_line {
Some(line) => format!("on line {line}").into(),
None => "outside the testfile".into(),
};
create_error(
format!("diagnostic code `{}` not found {line}", &**code),
Expand All @@ -683,6 +683,7 @@ fn print_error(error: &Error, path: &Path) {
}
Error::NoPatternsFound => {
print_error_header("expected error patterns, but found none");
println!("If this is expected, consider annotating the file with `//@check-pass`");
}
Error::PatternFoundInPassTest { mode, span } => {
let annot = [("expected because of this annotation", span.clone())];
Expand Down
7 changes: 7 additions & 0 deletions tests/integrations/basic-fail/Cargo.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@
= note: compilation succeeded, but was expected to fail

error: expected error patterns, but found none
If this is expected, consider annotating the file with `//@check-pass`

full stderr:

Expand Down Expand Up @@ -855,9 +856,9 @@
tests/actual_tests_bless/revisions.rs (revision `bar`) ... ok
tests/actual_tests_bless/revisions_bad.rs ... ok
tests/actual_tests_bless/revisions_bad.rs (revision `foo`) ... ok
tests/actual_tests_bless/revisions_bad.rs (revision `bar`) ... FAILED

Check failure on line 859 in tests/integrations/basic-fail/Cargo.stdout

View workflow job for this annotation

GitHub Actions / tests (macos-latest, x86_64-apple-darwin)

missing line in output

bless the test to create a line containing `tests/actual_tests_bless/revisions_filter.rs ... ok`
tests/actual_tests_bless/revisions_filter.rs ... ok
tests/actual_tests_bless/revisions_filter.rs (revision `foo`) ... ignored (in-test comment)

Check failure on line 861 in tests/integrations/basic-fail/Cargo.stdout

View workflow job for this annotation

GitHub Actions / tests (macos-latest, x86_64-apple-darwin)

extraneous lines in output

remove this line and possibly later ones by blessing the test
tests/actual_tests_bless/revisions_filter.rs (revision `bar`) ... ignored (in-test comment)
tests/actual_tests_bless/revisions_filter2.rs ... ok
tests/actual_tests_bless/revisions_filter2.rs (revision `foo`) ... ignored (in-test comment)
Expand Down Expand Up @@ -930,6 +931,7 @@
|

error: expected error patterns, but found none
If this is expected, consider annotating the file with `//@check-pass`

full stderr:
error: expected one of `!` or `::`, found `<eof>`
Expand Down Expand Up @@ -1033,6 +1035,7 @@
= note: compilation succeeded, but was expected to fail

error: expected error patterns, but found none
If this is expected, consider annotating the file with `//@check-pass`

full stderr:

Expand All @@ -1054,6 +1057,7 @@
|

error: expected error patterns, but found none
If this is expected, consider annotating the file with `//@check-pass`

full stderr:
error: cannot mix `bin` crate type with others
Expand All @@ -1079,6 +1083,7 @@
= note: compilation succeeded, but was expected to fail

error: expected error patterns, but found none
If this is expected, consider annotating the file with `//@check-pass`

full stderr:

Expand Down Expand Up @@ -1321,6 +1326,7 @@
= note: compilation succeeded, but was expected to fail

error: expected error patterns, but found none
If this is expected, consider annotating the file with `//@check-pass`

full stderr:
warning: unused variable: `Ě电脑`
Expand Down Expand Up @@ -1728,6 +1734,7 @@
= note: compilation succeeded, but was expected to fail

error: expected error patterns, but found none
If this is expected, consider annotating the file with `//@check-pass`


FAILED TEST: tests/actual_tests/filters.rs
Expand Down
Loading