-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexecutable_name_config_test.rs
More file actions
67 lines (58 loc) · 1.73 KB
/
executable_name_config_test.rs
File metadata and controls
67 lines (58 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use indoc::indoc;
use predicates::prelude::*;
use std::error::Error;
mod common;
use common::OutputStream;
use common::run_codeowners;
#[test]
fn test_validate_with_custom_executable_name() -> Result<(), Box<dyn Error>> {
// When executable_name is configured, error should show that command
run_codeowners(
"custom_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::str::contains("Run `bin/codeownership validate`"),
)?;
Ok(())
}
#[test]
fn test_validate_with_default_executable_name() -> Result<(), Box<dyn Error>> {
// When executable_name is not configured, error should show default "codeowners"
run_codeowners(
"default_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::str::contains("Run `codeowners generate`"),
)?;
Ok(())
}
#[test]
fn test_custom_executable_name_full_error_message() -> Result<(), Box<dyn Error>> {
// Verify the complete error message format with custom executable
run_codeowners(
"custom_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::eq(indoc! {"
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
"}),
)?;
Ok(())
}
#[test]
fn test_default_executable_name_full_error_message() -> Result<(), Box<dyn Error>> {
// Verify the complete error message format with default executable
run_codeowners(
"default_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::eq(indoc! {"
CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file
"}),
)?;
Ok(())
}