Skip to content

Commit 2e8ad9d

Browse files
committed
refactor(test/clitools): extract Config::expect_err_env()
1 parent 0eefe20 commit 2e8ad9d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/test/clitools.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ impl Config {
147147

148148
/// Expect an err status and a string in stderr
149149
pub async fn expect_err(&self, args: &[&str], expected: &str) {
150-
let out = self.run(args[0], &args[1..], &[]).await;
150+
self.expect_err_env(args, &[], expected).await
151+
}
152+
153+
/// Expect an err status and a string in stderr, with extra environment variables
154+
pub async fn expect_err_env(&self, args: &[&str], env: &[(&str, &str)], expected: &str) {
155+
let out = self.run(args[0], &args[1..], env).await;
151156
if out.ok || !out.stderr.contains(expected) {
152157
print_command(args, &out);
153158
println!("expected.ok: false");

0 commit comments

Comments
 (0)