Skip to content

Commit 88738ca

Browse files
committed
test: add integration test for dryrun error on init config
1 parent 9c75f29 commit 88738ca

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

tests/integration_test.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,3 +540,25 @@ fn changed_init_causes_warning() -> Result<()> {
540540
assert_output_snapshot("changed_init_causes_warning_2", &mut cmd)?;
541541
Ok(())
542542
}
543+
544+
// If you forgot to include a `@{{DRYRUN}}` argument in the init command, there
545+
// should be an error.
546+
#[test]
547+
fn excluding_dryrun_fails() -> Result<()> {
548+
let config = temp_config(
549+
"\
550+
[[linter]]
551+
code = 'TESTLINTER'
552+
include_patterns = []
553+
command = ['echo', 'foo']
554+
init_command = ['echo', 'bar']
555+
",
556+
)?;
557+
let mut cmd = Command::cargo_bin("lintrunner")?;
558+
cmd.arg(format!("--config={}", config.path().to_str().unwrap()));
559+
560+
cmd.assert().failure();
561+
assert_output_snapshot("excluding_dryrun_fails", &mut cmd)?;
562+
563+
Ok(())
564+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
source: tests/integration_test.rs
3+
expression: output_lines
4+
5+
---
6+
- "STDOUT:"
7+
- ""
8+
- ""
9+
- "STDERR:"
10+
- "error: Config for linter TESTLINTER defines init args but does not take a {{DRYRUN}} argument."
11+

0 commit comments

Comments
 (0)