From 7c63ce15d8f18613c27d7f09105365480a01a2ed Mon Sep 17 00:00:00 2001 From: pwygab <88221256+merelymyself@users.noreply.github.com> Date: Sat, 21 May 2022 10:48:36 +0800 Subject: [PATCH] attempts to allow the test to work when run as root (#5601) --- crates/nu-command/tests/commands/ls.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/tests/commands/ls.rs b/crates/nu-command/tests/commands/ls.rs index e78a982791..e9f13cccb7 100644 --- a/crates/nu-command/tests/commands/ls.rs +++ b/crates/nu-command/tests/commands/ls.rs @@ -259,9 +259,20 @@ fn fails_with_ls_to_dir_without_permission() { chmod 000 dir_a; ls dir_a "# )); - assert!(actual - .err - .contains("The permissions of 0 do not allow access for this user")); + + let check_not_root = nu!( + cwd: dirs.test(), pipeline( + r#" + id -u + "# + )); + + assert!( + actual + .err + .contains("The permissions of 0 do not allow access for this user") + || check_not_root.out == "0" + ); }) }