From a6f94c132c425bbab543e98fcd19f4ff7519d1b7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 14 Jan 2017 16:38:08 -0500 Subject: Implement -printf/-fprintf Based on a patch by Fangrui Song . Closes #16. --- tests.sh | 51 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 9 deletions(-) (limited to 'tests.sh') diff --git a/tests.sh b/tests.sh index 5a7e650..7e85cff 100755 --- a/tests.sh +++ b/tests.sh @@ -145,7 +145,7 @@ for arg; do done function bfs_sort() { - awk -F/ '{ print NF - 1 " " $0 }' | sort -n | awk '{ print $2 }' + awk -F/ '{ print NF - 1 " " $0 }' | sort -n | cut -d' ' -f2- } function bfs_diff() { @@ -787,13 +787,6 @@ function test_0127() { bfs_diff basic -inum "$inode" } -function test_0127() { - [ "$BSD" -o "$GNU" ] || return 0 - - local inode="$(ls -id basic/k/foo/bar | cut -f1 -d' ')" - bfs_diff basic -inum "$inode" -} - function test_0128() { [ "$BSD" -o "$GNU" ] || return 0 bfs_diff basic -nogroup @@ -804,9 +797,49 @@ function test_0129() { bfs_diff basic -nouser } +function test_0130() { + [ "$GNU" ] || return 0 + bfs_diff basic -printf '%%p(%p) %%d(%d) %%f(%f) %%h(%h) %%H(%H) %%P(%P) %%m(%m) %%M(%M) %%y(%y)\n' +} + +function test_0131() { + [ "$GNU" ] || return 0 + bfs_diff / -maxdepth 0 -printf '(%h)/(%f)\n' +} + +function test_0132() { + [ "$GNU" ] || return 0 + bfs_diff /// -maxdepth 0 -printf '(%h)/(%f)\n' +} + +function test_0133() { + [ "$GNU" ] || return 0 + bfs_diff basic/ -printf '(%h)/(%f)\n' +} + +function test_0134() { + [ "$GNU" ] || return 0 + bfs_diff basic/// -printf '(%h)/(%f)\n' +} + +function test_0135() { + [ "$GNU" ] || return 0 + bfs_diff basic -printf '|%- 10.10p| %+03d %#4m\n' +} + +function test_0136() { + [ "$GNU" ] || return 0 + bfs_diff links -printf '(%p) (%l) %y %Y\n' +} + +function test_0137() { + [ "$GNU" ] || return 0 + bfs_diff basic -maxdepth 0 -printf '\18\118\1118\11118\n\cfoo' +} + result=0 -for i in {1..129}; do +for i in {1..137}; do test="test_$(printf '%04d' $i)" if [ -t 1 ]; then -- cgit v1.2.3