Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 5874a14

Browse files
authored
token-cli: Move cmd test into a separate file (#3306)
1 parent c1ee6a5 commit 5874a14

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

token/cli/src/main.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3170,14 +3170,13 @@ fn handle_tx(
31703170
mod tests {
31713171
use {
31723172
super::*,
3173-
assert_cmd::prelude::*,
31743173
solana_client::blockhash_query::Source,
31753174
solana_sdk::{
31763175
bpf_loader,
31773176
signature::{Keypair, Signer},
31783177
},
31793178
solana_test_validator::{ProgramInfo, TestValidator, TestValidatorGenesis},
3180-
std::{path::PathBuf, process::Command},
3179+
std::path::PathBuf,
31813180
};
31823181

31833182
fn clone_keypair(keypair: &Keypair) -> Keypair {
@@ -3715,16 +3714,4 @@ mod tests {
37153714
assert_eq!(ui_account.mint, token.to_string());
37163715
assert_eq!(ui_account.owner, aux_string);
37173716
}
3718-
3719-
#[test]
3720-
fn invalid_config_will_cause_commands_to_fail() {
3721-
let mut cmd = Command::cargo_bin("spl-token").unwrap();
3722-
let args = &["address", "--config", "~/nonexistent/config.yml"];
3723-
3724-
cmd.args(args)
3725-
.assert()
3726-
.stderr("error: Could not find config file `~/nonexistent/config.yml`\n");
3727-
3728-
cmd.args(args).assert().code(1).failure();
3729-
}
37303717
}

token/cli/tests/config.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use assert_cmd::cmd::Command;
2+
3+
#[test]
4+
fn invalid_config_will_cause_commands_to_fail() {
5+
let mut cmd = Command::cargo_bin("spl-token").unwrap();
6+
let args = &["address", "--config", "~/nonexistent/config.yml"];
7+
cmd.args(args)
8+
.assert()
9+
.stderr("error: Could not find config file `~/nonexistent/config.yml`\n");
10+
cmd.args(args).assert().code(1).failure();
11+
}

0 commit comments

Comments
 (0)