Skip to content

Commit

Permalink
test: add flags test on commands.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelrcamargo committed Sep 28, 2023
1 parent be3d611 commit 49019f5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

use clap::{arg, ArgMatches, Command};

pub fn args() -> Command {
Expand Down
2 changes: 2 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

use clap::ArgMatches;
use colored::{ColoredString, Colorize};
use terminal_size::{terminal_size, Width};
Expand Down
10 changes: 8 additions & 2 deletions tests/command.rs → tests/commands.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

#[path = "../src/utils.rs"]
mod utils;

Expand Down Expand Up @@ -33,4 +31,12 @@ mod command {

assert_eq!(command, vec!["stats", "--format", "json", "123", "456"]);
}

#[test]
fn check_flags() {
let matches = cli::args().get_matches_from(vec!["ds", "123", "-c", "456", "-f"]);

assert!(cli::has_arg(&matches, "compact"));
assert!(cli::has_arg(&matches, "full"));
}
}
2 changes: 0 additions & 2 deletions tests/fillers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(dead_code)]

#[path = "../src/utils.rs"]
mod utils;

Expand Down

0 comments on commit 49019f5

Please sign in to comment.