Skip to content

Commit

Permalink
test: add integration test for dryrun error on init config
Browse files Browse the repository at this point in the history
  • Loading branch information
suo committed Apr 17, 2022
1 parent 9c75f29 commit 88738ca
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,3 +540,25 @@ fn changed_init_causes_warning() -> Result<()> {
assert_output_snapshot("changed_init_causes_warning_2", &mut cmd)?;
Ok(())
}

// If you forgot to include a `@{{DRYRUN}}` argument in the init command, there
// should be an error.
#[test]
fn excluding_dryrun_fails() -> Result<()> {
let config = temp_config(
"\
[[linter]]
code = 'TESTLINTER'
include_patterns = []
command = ['echo', 'foo']
init_command = ['echo', 'bar']
",
)?;
let mut cmd = Command::cargo_bin("lintrunner")?;
cmd.arg(format!("--config={}", config.path().to_str().unwrap()));

cmd.assert().failure();
assert_output_snapshot("excluding_dryrun_fails", &mut cmd)?;

Ok(())
}
11 changes: 11 additions & 0 deletions tests/snapshots/integration_test__excluding_dryrun_fails.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
source: tests/integration_test.rs
expression: output_lines

---
- "STDOUT:"
- ""
- ""
- "STDERR:"
- "error: Config for linter TESTLINTER defines init args but does not take a {{DRYRUN}} argument."

0 comments on commit 88738ca

Please sign in to comment.