From fa767895d4165dc9b0a8808f4760141067e0ea12 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 13 Mar 2022 13:30:52 -0400 Subject: tests: Use skip_if for more tests --- tests.sh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tests.sh b/tests.sh index 995b7a6..d41f875 100755 --- a/tests.sh +++ b/tests.sh @@ -1388,15 +1388,13 @@ function test_gid() { } function test_gid_plus() { - if [ "$(id -g)" -ne 0 ]; then - bfs_diff basic -gid +0 - fi + skip_if test "$(id -g)" -eq 0 + bfs_diff basic -gid +0 } function test_gid_plus_plus() { - if [ "$(id -g)" -ne 0 ]; then - bfs_diff basic -gid ++0 - fi + skip_if test "$(id -g)" -eq 0 + bfs_diff basic -gid ++0 } function test_gid_minus() { @@ -1412,15 +1410,13 @@ function test_uid() { } function test_uid_plus() { - if [ "$(id -u)" -ne 0 ]; then - bfs_diff basic -uid +0 - fi + skip_if test "$(id -u)" -eq 0 + bfs_diff basic -uid +0 } function test_uid_plus_plus() { - if [ "$(id -u)" -ne 0 ]; then - bfs_diff basic -uid ++0 - fi + skip_if test "$(id -u)" -eq 0 + bfs_diff basic -uid ++0 } function test_uid_minus() { @@ -1794,9 +1790,9 @@ function test_execdir() { } function test_execdir_plus() { - if [[ "$BFS" != *"-S dfs"* ]]; then - bfs_diff basic -execdir "$TESTS/sort-args.sh" '{}' + - fi + local tree=$(invoke_bfs -D tree 2>&1 -quit) + skip_if eval '[[ "$tree" == *"-S dfs"* ]]' + bfs_diff basic -execdir "$TESTS/sort-args.sh" '{}' + } function test_execdir_substring() { -- cgit v1.2.3