summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2021-03-28 15:20:20 -0400
committerTavian Barnes <tavianator@tavianator.com>2021-03-28 15:20:20 -0400
commit48dfba55b283120a534f0e5ed9c0f4ee694ad5df (patch)
treeadc45bacb3b3d518df3dfc2acbc55f889bd8c561
parentcd4b0f1d87e836e78c2de92623e20284a057b500 (diff)
downloadbfs-48dfba55b283120a534f0e5ed9c0f4ee694ad5df.tar.xz
test: Add more tests for -H/-L and -type l
-rwxr-xr-xtests.sh18
-rw-r--r--tests/test_H_type_l.out2
-rw-r--r--tests/test_L.out2
-rw-r--r--tests/test_L_depth.out2
-rw-r--r--tests/test_L_type_l.out1
-rw-r--r--tests/test_L_xtype_l.out2
-rw-r--r--tests/test_expr_flag_path.out1
-rw-r--r--tests/test_expr_path_flag.out1
-rw-r--r--tests/test_flag_expr_path.out1
-rw-r--r--tests/test_follow.out2
-rw-r--r--tests/test_path_expr_flag.out1
-rw-r--r--tests/test_path_flag_expr.out1
-rw-r--r--tests/test_printf_H.out1
-rw-r--r--tests/test_printf_l_nonlink.out25
-rw-r--r--tests/test_type_l.out1
-rw-r--r--tests/test_xtype_l.out1
16 files changed, 49 insertions, 13 deletions
diff --git a/tests.sh b/tests.sh
index 8eb4dc0..81ed14e 100755
--- a/tests.sh
+++ b/tests.sh
@@ -274,6 +274,9 @@ posix_tests=(
test_type_d
test_type_f
+ test_type_l
+ test_H_type_l
+ test_L_type_l
test_user_name
test_user_id
@@ -886,6 +889,7 @@ function make_links() {
mkdir -p "$1/deeply/nested/dir"
touchp "$1/deeply/nested/file"
ln -s file "$1/deeply/nested/link"
+ ln -s nowhere "$1/deeply/nested/broken"
ln -s deeply/nested "$1/skip"
}
make_links "$TMP/links"
@@ -1124,6 +1128,18 @@ function test_type_f() {
bfs_diff basic -type f
}
+function test_type_l() {
+ bfs_diff links/skip -type l
+}
+
+function test_H_type_l() {
+ bfs_diff -H links/skip -type l
+}
+
+function test_L_type_l() {
+ bfs_diff -L links/skip -type l
+}
+
function test_type_multi() {
bfs_diff links -type f,d,c
}
@@ -2150,7 +2166,7 @@ function test_printf_u_g_ulimit() {
}
function test_printf_l_nonlink() {
- bfs_diff links -printf '| %24p -> %-24l |\n'
+ bfs_diff links -printf '| %26p -> %-26l |\n'
}
function test_printf_incomplete_escape() {
diff --git a/tests/test_H_type_l.out b/tests/test_H_type_l.out
new file mode 100644
index 0000000..e67f10b
--- /dev/null
+++ b/tests/test_H_type_l.out
@@ -0,0 +1,2 @@
+links/skip/broken
+links/skip/link
diff --git a/tests/test_L.out b/tests/test_L.out
index cf21a44..e24f4f7 100644
--- a/tests/test_L.out
+++ b/tests/test_L.out
@@ -7,9 +7,11 @@ links/notdir
links/skip
links/symlink
links/deeply/nested
+links/skip/broken
links/skip/dir
links/skip/file
links/skip/link
+links/deeply/nested/broken
links/deeply/nested/dir
links/deeply/nested/file
links/deeply/nested/link
diff --git a/tests/test_L_depth.out b/tests/test_L_depth.out
index cf21a44..e24f4f7 100644
--- a/tests/test_L_depth.out
+++ b/tests/test_L_depth.out
@@ -7,9 +7,11 @@ links/notdir
links/skip
links/symlink
links/deeply/nested
+links/skip/broken
links/skip/dir
links/skip/file
links/skip/link
+links/deeply/nested/broken
links/deeply/nested/dir
links/deeply/nested/file
links/deeply/nested/link
diff --git a/tests/test_L_type_l.out b/tests/test_L_type_l.out
new file mode 100644
index 0000000..725d398
--- /dev/null
+++ b/tests/test_L_type_l.out
@@ -0,0 +1 @@
+links/skip/broken
diff --git a/tests/test_L_xtype_l.out b/tests/test_L_xtype_l.out
index 1cb0e19..93cfc26 100644
--- a/tests/test_L_xtype_l.out
+++ b/tests/test_L_xtype_l.out
@@ -2,5 +2,7 @@ links/broken
links/notdir
links/skip
links/symlink
+links/skip/broken
links/skip/link
+links/deeply/nested/broken
links/deeply/nested/link
diff --git a/tests/test_expr_flag_path.out b/tests/test_expr_flag_path.out
index 3112cd2..e67f10b 100644
--- a/tests/test_expr_flag_path.out
+++ b/tests/test_expr_flag_path.out
@@ -1 +1,2 @@
+links/skip/broken
links/skip/link
diff --git a/tests/test_expr_path_flag.out b/tests/test_expr_path_flag.out
index 3112cd2..e67f10b 100644
--- a/tests/test_expr_path_flag.out
+++ b/tests/test_expr_path_flag.out
@@ -1 +1,2 @@
+links/skip/broken
links/skip/link
diff --git a/tests/test_flag_expr_path.out b/tests/test_flag_expr_path.out
index 3112cd2..e67f10b 100644
--- a/tests/test_flag_expr_path.out
+++ b/tests/test_flag_expr_path.out
@@ -1 +1,2 @@
+links/skip/broken
links/skip/link
diff --git a/tests/test_follow.out b/tests/test_follow.out
index cf21a44..e24f4f7 100644
--- a/tests/test_follow.out
+++ b/tests/test_follow.out
@@ -7,9 +7,11 @@ links/notdir
links/skip
links/symlink
links/deeply/nested
+links/skip/broken
links/skip/dir
links/skip/file
links/skip/link
+links/deeply/nested/broken
links/deeply/nested/dir
links/deeply/nested/file
links/deeply/nested/link
diff --git a/tests/test_path_expr_flag.out b/tests/test_path_expr_flag.out
index 3112cd2..e67f10b 100644
--- a/tests/test_path_expr_flag.out
+++ b/tests/test_path_expr_flag.out
@@ -1 +1,2 @@
+links/skip/broken
links/skip/link
diff --git a/tests/test_path_flag_expr.out b/tests/test_path_flag_expr.out
index 3112cd2..e67f10b 100644
--- a/tests/test_path_flag_expr.out
+++ b/tests/test_path_flag_expr.out
@@ -1 +1,2 @@
+links/skip/broken
links/skip/link
diff --git a/tests/test_printf_H.out b/tests/test_printf_H.out
index 320c9e7..116b425 100644
--- a/tests/test_printf_H.out
+++ b/tests/test_printf_H.out
@@ -25,6 +25,7 @@
%p(links/deeply/nested) %d(2) %f(nested) %h(links/deeply) %H(links) %P(deeply/nested) %y(d)
%p(basic/k/foo/bar) %d(3) %f(bar) %h(basic/k/foo) %H(basic) %P(k/foo/bar) %y(f)
%p(basic/l/foo/bar) %d(3) %f(bar) %h(basic/l/foo) %H(basic) %P(l/foo/bar) %y(d)
+%p(links/deeply/nested/broken) %d(3) %f(broken) %h(links/deeply/nested) %H(links) %P(deeply/nested/broken) %y(l)
%p(links/deeply/nested/dir) %d(3) %f(dir) %h(links/deeply/nested) %H(links) %P(deeply/nested/dir) %y(d)
%p(links/deeply/nested/file) %d(3) %f(file) %h(links/deeply/nested) %H(links) %P(deeply/nested/file) %y(f)
%p(links/deeply/nested/link) %d(3) %f(link) %h(links/deeply/nested) %H(links) %P(deeply/nested/link) %y(l)
diff --git a/tests/test_printf_l_nonlink.out b/tests/test_printf_l_nonlink.out
index e356c24..66e2908 100644
--- a/tests/test_printf_l_nonlink.out
+++ b/tests/test_printf_l_nonlink.out
@@ -1,12 +1,13 @@
-| links -> |
-| links/file -> |
-| links/broken -> nowhere |
-| links/deeply -> |
-| links/symlink -> file |
-| links/hardlink -> |
-| links/skip -> deeply/nested |
-| links/notdir -> symlink/file |
-| links/deeply/nested -> |
-| links/deeply/nested/dir -> |
-| links/deeply/nested/file -> |
-| links/deeply/nested/link -> file |
+| links -> |
+| links/file -> |
+| links/broken -> nowhere |
+| links/deeply -> |
+| links/symlink -> file |
+| links/hardlink -> |
+| links/skip -> deeply/nested |
+| links/notdir -> symlink/file |
+| links/deeply/nested -> |
+| links/deeply/nested/dir -> |
+| links/deeply/nested/file -> |
+| links/deeply/nested/link -> file |
+| links/deeply/nested/broken -> nowhere |
diff --git a/tests/test_type_l.out b/tests/test_type_l.out
new file mode 100644
index 0000000..f2c8b19
--- /dev/null
+++ b/tests/test_type_l.out
@@ -0,0 +1 @@
+links/skip
diff --git a/tests/test_xtype_l.out b/tests/test_xtype_l.out
index 8b0a404..62d3ae4 100644
--- a/tests/test_xtype_l.out
+++ b/tests/test_xtype_l.out
@@ -1,2 +1,3 @@
links/broken
links/notdir
+links/deeply/nested/broken