From b4af0d02d5192924ae5252013e7673942cf1799c Mon Sep 17 00:00:00 2001 From: Anup Mahindre Date: Sun, 18 Apr 2021 16:59:23 +0530 Subject: [PATCH] tests/ls: Add testcase for error paths with width option --- tests/by-util/test_ls.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index d810cdc294f..5583dbaca5f 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -103,6 +103,14 @@ fn test_ls_width() { .succeeds() .stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n"); } + + for option in &["-w 1a", "-w=1a", "--width=1a", "--width 1a"] { + scene + .ucmd() + .args(&option.split(" ").collect::>()) + .fails() + .stderr_only("ls: error: invalid line width: ‘1a’"); + } } #[test]