Skip to content

Commit 1681794

Browse files
committed
test: add hex flag test for lscpu
1 parent ffe2ba6 commit 1681794

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/uu/lscpu/src/lscpu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const USAGE: &str = help_usage!("lscpu.md");
1616
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
1717
let _matches: clap::ArgMatches = uu_app().try_get_matches_from(args)?;
1818
let system = System::new_all();
19-
let hex= _matches.get_flag(options::HEX);
19+
let hex = _matches.get_flag(options::HEX);
2020

2121
println!("Architecture: {}", get_architecture());
2222
if hex {

tests/by-util/test_lscpu.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ use crate::common::util::TestScenario;
99
fn test_invalid_arg() {
1010
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
1111
}
12+
13+
#[test]
14+
fn test_lscpt_with_arg() {
15+
new_ucmd!().arg("--hex").succeeds().stdout_contains("0x");
16+
}

0 commit comments

Comments
 (0)