From 21f1a119c3378e9cc17603352c1903a72845d4b2 Mon Sep 17 00:00:00 2001 From: Rayhan Faizel Date: Tue, 6 Jun 2023 20:56:42 +0530 Subject: [PATCH] tests/ls: Implement tests for sort by width option --- tests/by-util/test_ls.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 45ced867a..49c2272c0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1564,6 +1564,28 @@ fn test_ls_sort_name() { .stdout_is(".a\n.b\na\nb\n"); } +#[test] +fn test_ls_sort_width() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("aaaaa"); + at.touch("bbb"); + at.touch("cccc"); + at.touch("eee"); + at.touch("d"); + at.touch("fffff"); + at.touch("abc"); + at.touch("zz"); + at.touch("bcdef"); + + scene + .ucmd() + .arg("--sort=width") + .succeeds() + .stdout_is("d\nzz\nabc\nbbb\neee\ncccc\naaaaa\nbcdef\nfffff\n"); +} + #[test] fn test_ls_order_size() { let scene = TestScenario::new(util_name!());