Skip to content

Commit

Permalink
update tests to use the usage error message prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
jqnatividad committed Sep 8, 2023
1 parent e74b543 commit 8ca6c98
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
17 changes: 10 additions & 7 deletions tests/test_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn apply_ops_unknown_operation() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert_eq!(&*got, "usage: Unknown 'obfuscate' operation\n")
assert_eq!(&*got, "usage error: Unknown 'obfuscate' operation\n")
}

#[test]
Expand Down Expand Up @@ -133,7 +133,7 @@ fn apply_ops_upper_rename_invalid() {
let got: String = wrk.output_stderr(&mut cmd);
assert_eq!(
got,
"usage: Number of new columns does not match input column selection.\n"
"usage error: Number of new columns does not match input column selection.\n"
);
}

Expand Down Expand Up @@ -909,7 +909,8 @@ fn apply_ops_replace_validation_error() {
let got = wrk.output_stderr(&mut cmd);
assert_eq!(
got,
"usage: --comparand (-C) and --replacement (-R) are required for replace operation.\n"
"usage error: --comparand (-C) and --replacement (-R) are required for replace \
operation.\n"
);
wrk.assert_err(&mut cmd);
}
Expand Down Expand Up @@ -972,7 +973,7 @@ fn apply_ops_regex_replace_validation_error() {
let got = wrk.output_stderr(&mut cmd);
assert_eq!(
got,
"usage: --comparand (-C) and --replacement (-R) are required for regex_replace \
"usage error: --comparand (-C) and --replacement (-R) are required for regex_replace \
operation.\n"
);
wrk.assert_err(&mut cmd);
Expand Down Expand Up @@ -1092,8 +1093,9 @@ fn apply_ops_chain_validation_error() {
let got = wrk.output_stderr(&mut cmd);
assert_eq!(
got,
"usage: you can only use censor(0), copy(0), eudex(0), regex_replace(0), replace(0), \
sentiment(0), similarity(2), strip(0), and whatlang(0) ONCE per operation series.\n"
"usage error: you can only use censor(0), copy(0), eudex(0), regex_replace(0), \
replace(0), sentiment(0), similarity(2), strip(0), and whatlang(0) ONCE per operation \
series.\n"
);
wrk.assert_err(&mut cmd);
}
Expand All @@ -1116,7 +1118,8 @@ fn apply_ops_chain_validation_error_missing_comparand() {
let got = wrk.output_stderr(&mut cmd);
assert_eq!(
got,
"usage: --comparand (-C) and --new_column (-c) is required for similarity operations.\n"
"usage error: --comparand (-C) and --new_column (-c) is required for similarity \
operations.\n"
);
wrk.assert_err(&mut cmd);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_excel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ fn excel_invalid_sheet_index() {
cmd.arg("--sheet").arg("100").arg(xls_file);

let got = wrk.output_stderr(&mut cmd);
let expected = "usage: sheet index 100 is greater than number of sheets 8\n".to_string();
let expected = "usage error: sheet index 100 is greater than number of sheets 8\n".to_string();
assert_eq!(got, expected);
wrk.assert_err(&mut cmd);
}
Expand Down
14 changes: 7 additions & 7 deletions tests/test_fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ fn fetch_jql_jqlfile_error() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert!(got.starts_with("usage: Invalid arguments."));
assert!(got.starts_with("usage error: Invalid arguments."));

wrk.assert_err(&mut cmd);
}
Expand Down Expand Up @@ -455,7 +455,7 @@ fn fetch_custom_invalid_header_error() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert!(got.starts_with("usage: Invalid header name"));
assert!(got.starts_with("usage error: Invalid header name"));

wrk.assert_err(&mut cmd);
}
Expand All @@ -475,7 +475,7 @@ fn fetch_custom_invalid_user_agent_error() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert!(got.starts_with("usage: Invalid user-agent"));
assert!(got.starts_with("usage error: Invalid user-agent"));

wrk.assert_err(&mut cmd);
}
Expand Down Expand Up @@ -534,7 +534,7 @@ fn fetch_custom_invalid_value_error() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert!(got.starts_with("usage: Invalid header value"));
assert!(got.starts_with("usage error: Invalid header value"));

wrk.assert_err(&mut cmd);
}
Expand All @@ -559,7 +559,7 @@ fn fetchpost_custom_invalid_header_error() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert!(got.starts_with("usage: Invalid header name"));
assert!(got.starts_with("usage error: Invalid header name"));

wrk.assert_err(&mut cmd);
}
Expand All @@ -584,7 +584,7 @@ fn fetchpost_custom_invalid_value_error() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert!(got.starts_with("usage: Invalid header value"));
assert!(got.starts_with("usage error: Invalid header value"));

wrk.assert_err(&mut cmd);
}
Expand All @@ -610,7 +610,7 @@ fn fetchpost_custom_invalid_user_agent_error() {
.arg("data.csv");

let got: String = wrk.output_stderr(&mut cmd);
assert!(got.starts_with("usage: Invalid user-agent"));
assert!(got.starts_with("usage error: Invalid user-agent"));

wrk.assert_err(&mut cmd);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn invalid_delimiter_len() {
let got: String = wrk.output_stderr(&mut cmd);
assert_eq!(
&*got,
"usage: Could not convert '||' to a single ASCII character.\n"
"usage error: Could not convert '||' to a single ASCII character.\n"
)
}

Expand Down

0 comments on commit 8ca6c98

Please sign in to comment.