Add tests

This commit is contained in:
Foorack 2025-02-08 17:56:43 +01:00
parent afd27bdcaf
commit 306a366900

@ -10,6 +10,15 @@ fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}
#[test]
fn test_basic() {
// Verify basic usage with no args prints both table and summary
new_ucmd!()
.succeeds()
.stdout_contains("STATE REMOVABLE")
.stdout_contains("Memory block size:");
}
#[test]
fn test_table_not_padded() {
let result = new_ucmd!().succeeds();
@ -19,3 +28,11 @@ fn test_table_not_padded() {
"Table output should not start with a space"
);
}
#[test]
fn test_json_output() {
new_ucmd!()
.arg("-J")
.succeeds()
.stdout_contains(" \"memory\": [\n");
}