Hello

These two patches improve the test coverage of ls & cksum.

The first patch tests that symlink with --dired are correctly positioned.

The second that comments on a checksum files aren't causing any validation issues (but impacts the line number).

Thanks,
Sylvestre
From 6b403fe6e73c072484ce76c9173c4c22c9548b14 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <sylves...@debian.org>
Date: Thu, 17 Oct 2024 22:26:43 +0200
Subject: [PATCH 1/2] tests: improve ls --dired with symlink testing

* tests/ls/dired.sh: Verify ls --dired with symlink
---
 tests/ls/dired.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/ls/dired.sh b/tests/ls/dired.sh
index 7c6c03bd4..a9d1f05cf 100755
--- a/tests/ls/dired.sh
+++ b/tests/ls/dired.sh
@@ -39,11 +39,13 @@ done
 # Also use multibyte characters to show --dired counts bytes not characters
 touch dir/1a dir/2á || framework_failure_
 mkdir -p dir/3dir || framework_failure_
+touch dir/aaa || framework_failure_
+ln -s target dir/aaa_link || framework_failure_
 
-ls -l --dired dir > out || fail=1
+ls -lf --dired dir > out || fail=1
 
 dired_values=$(grep "//DIRED//" out| cut -d' ' -f2-)
-expected_files="1a 2á 3dir"
+expected_files=".. aaa_link 2á 1a 3dir . aaa "
 
 dired_count=$(printf '%s\n' $dired_values | wc -l)
 expected_count=$(printf '%s\n' $expected_files | wc -l)
-- 
2.45.2

From 7c3accb302e35269421fa42bb0229649d627b2a6 Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <sylves...@debian.org>
Date: Fri, 18 Oct 2024 22:30:01 +0200
Subject: [PATCH 2/2] tests: cksum: verify the results when the file contains a
 comment

* tests/cksum/cksum-c.sh: Add a test case with a comment
---
 tests/cksum/cksum-c.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/cksum/cksum-c.sh b/tests/cksum/cksum-c.sh
index ff4e4ae07..463ce09a0 100755
--- a/tests/cksum/cksum-c.sh
+++ b/tests/cksum/cksum-c.sh
@@ -61,6 +61,10 @@ cksum --status --check CHECKSUMS >out 2>&1 || fail=1
 # Should be empty
 compare /dev/null out || fail=1
 
+# Add a comment. No errors
+echo '# Very important comment' >> CHECKSUMS
+cksum --status --check CHECKSUMS >out 2>&1 || fail=1
+
 # Check for the error mgmt
 echo 'invalid line' >> CHECKSUMS
 # Exit code is 0 in this case
@@ -99,8 +103,8 @@ compare /dev/null out || fail=1
 echo "BLAKE2b (missing-file) = $invalid_sum" >> CHECKSUMS
 cksum --warn --check CHECKSUMS > out 2>&1
 # check that the incorrect lines are correctly reported with --warn
-grep 'CHECKSUMS: 5: improperly formatted SM3 checksum line' out || fail=1
-grep 'CHECKSUMS: 8: improperly formatted BLAKE2b checksum line' out || fail=1
+grep 'CHECKSUMS: 6: improperly formatted SM3 checksum line' out || fail=1
+grep 'CHECKSUMS: 9: improperly formatted BLAKE2b checksum line' out || fail=1
 
 # Test --ignore-missing
 
@@ -120,7 +124,7 @@ grep 'CHECKSUMS-missing: no file was verified' stderr || fail=1
 # Combination of --status and --warn
 cksum --status --warn --check CHECKSUMS > out 2>&1 && fail=1
 
-grep 'CHECKSUMS: 8: improperly formatted BLAKE2b checksum line' out || fail=1
+grep 'CHECKSUMS: 9: improperly formatted BLAKE2b checksum line' out || fail=1
 grep 'WARNING: 3 lines are improperly formatted' out || fail=1
 grep 'WARNING: 1 computed checksum did NOT match' out || fail=1
 
-- 
2.45.2

Reply via email to