From 8ca6c983818e5a5d254a8f3286c3e8db3079d1c0 Mon Sep 17 00:00:00 2001 From: Joel Natividad <1980690+jqnatividad@users.noreply.github.com> Date: Fri, 8 Sep 2023 10:58:19 -0400 Subject: [PATCH] update tests to use the usage error message prefix. --- tests/test_apply.rs | 17 ++++++++++------- tests/test_excel.rs | 2 +- tests/test_fetch.rs | 14 +++++++------- tests/test_table.rs | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/test_apply.rs b/tests/test_apply.rs index ac5b1af2d..3a9e72cfe 100644 --- a/tests/test_apply.rs +++ b/tests/test_apply.rs @@ -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] @@ -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" ); } @@ -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); } @@ -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); @@ -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); } @@ -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); } diff --git a/tests/test_excel.rs b/tests/test_excel.rs index 2c96785ee..c6bb90b15 100644 --- a/tests/test_excel.rs +++ b/tests/test_excel.rs @@ -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); } diff --git a/tests/test_fetch.rs b/tests/test_fetch.rs index b30285550..5aec7d626 100644 --- a/tests/test_fetch.rs +++ b/tests/test_fetch.rs @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } @@ -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); } diff --git a/tests/test_table.rs b/tests/test_table.rs index d1637c207..b0b18c077 100644 --- a/tests/test_table.rs +++ b/tests/test_table.rs @@ -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" ) }