Skip to content

Commit

Permalink
test: add hex flag test for lscpu
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshit933 committed Jan 24, 2025
1 parent ffe2ba6 commit 1681794
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/uu/lscpu/src/lscpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const USAGE: &str = help_usage!("lscpu.md");
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let _matches: clap::ArgMatches = uu_app().try_get_matches_from(args)?;
let system = System::new_all();
let hex= _matches.get_flag(options::HEX);
let hex = _matches.get_flag(options::HEX);

println!("Architecture: {}", get_architecture());
if hex {
Expand Down
5 changes: 5 additions & 0 deletions tests/by-util/test_lscpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ use crate::common::util::TestScenario;
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}

#[test]
fn test_lscpt_with_arg() {
new_ucmd!().arg("--hex").succeeds().stdout_contains("0x");
}

0 comments on commit 1681794

Please sign in to comment.