From c5413167e25a8865d52b5edf5d24e8944ed8b89c Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sat, 9 Apr 2022 12:40:52 -0400 Subject: [PATCH] df: correct --total argument used in unit test Add a missing dash to the `--total` argument applied in the `test_df_output` test case. Before this commit, the argument `-total` was treated as a path argument. After this commit, `--total` is treated as a command-line option that causes the total file usage to be displayed. --- tests/by-util/test_df.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index fa77a8096..a88212146 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -28,16 +28,18 @@ fn test_df_compatible_si() { #[test] fn test_df_output() { - // TODO These should fail because `-total` should have two dashes, - // not just one. But they don't fail. - if cfg!(target_os = "macos") { - new_ucmd!().arg("-H").arg("-total").succeeds(). - stdout_only("Filesystem Size Used Available Capacity Use% Mounted on \n"); + let expected = if cfg!(target_os = "macos") { + "Filesystem Size Used Available Capacity Use% Mounted on " } else { - new_ucmd!().arg("-H").arg("-total").succeeds().stdout_only( - "Filesystem Size Used Available Use% Mounted on \n", - ); - } + "Filesystem Size Used Available Use% Mounted on " + }; + let output = new_ucmd!() + .arg("-H") + .arg("--total") + .succeeds() + .stdout_move_str(); + let actual = output.lines().take(1).collect::>()[0]; + assert_eq!(actual, expected); } /// Test that the order of rows in the table does not change across executions.