lscpu: Add option --json

closes #15
This commit is contained in:
Yang Hau
2024-07-25 04:54:17 +08:00
committed by Daniel Hofstetter
parent 07b28d8205
commit 4fc7653e84
5 changed files with 201 additions and 119 deletions

View File

@@ -14,3 +14,14 @@ fn test_invalid_arg() {
fn test_hex() {
new_ucmd!().arg("--hex").succeeds().stdout_contains("0x");
}
#[test]
fn test_json() {
new_ucmd!()
.arg("--json")
.succeeds()
// ensure some fields are there, non-exhausting
.stdout_contains("\"lscpu\": [")
.stdout_contains("\"field\": \"Architecture\"")
.stdout_contains("\"field\": \"CPU(s)\"");
}