diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2021-09-26 15:23:26 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2021-09-26 15:23:26 -0400 |
commit | 78944c815a5d8d1c93771ca1c343b9406bc262c4 (patch) | |
tree | 0e11144b526a3a1cebeedf4f7277b60d40488580 /tests.sh | |
parent | 2e918d33be152c1a57ffb3ff53e344cafb161a8c (diff) | |
download | bfs-78944c815a5d8d1c93771ca1c343b9406bc262c4.tar.xz |
Don't truncate files until we know they're not duplicates
Diffstat (limited to 'tests.sh')
-rwxr-xr-x | tests.sh | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -518,6 +518,7 @@ gnu_tests=( test_fprint test_fprint_duplicate test_fprint_error + test_fprint_truncate test_fprint0 @@ -723,6 +724,7 @@ bfs_tests=( test_execdir_plus + test_fprint_append test_fprint_duplicate_stdout test_fprint_error_stdout test_fprint_error_stderr @@ -1725,6 +1727,33 @@ function test_fprint_duplicate_stdout() { fi } +function test_fprint_truncate() { + printf "basic\nbasic\n" >scratch/test_fprint_truncate.out + + invoke_bfs basic -maxdepth 0 -fprint scratch/test_fprint_truncate.out + sort -o scratch/test_fprint_truncate.out scratch/test_fprint_truncate.out + + if [ "$UPDATE" ]; then + cp {scratch,"$TESTS"}/test_fprint_truncate.out + else + diff -u {"$TESTS",scratch}/test_fprint_truncate.out + fi +} + +function test_fprint_append() { + rm -f scratch/test_fprint_append.out + + invoke_bfs basic -fprint scratch/test_fprint_append.out >>scratch/test_fprint_append.out + invoke_bfs basic -fprint scratch/test_fprint_append.out >>scratch/test_fprint_append.out + sort -o scratch/test_fprint_append.out scratch/test_fprint_append.out + + if [ "$UPDATE" ]; then + cp {scratch,"$TESTS"}/test_fprint_append.out + else + diff -u {"$TESTS",scratch}/test_fprint_append.out + fi +} + function test_double_dash() { cd basic bfs_diff -- . -type f |