git: 58073ccbe358 - stable/13 - tail: Verify correct behavior when input does not end in a newline.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Dec 2023 20:06:33 UTC
The branch stable/13 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=58073ccbe358ecc0c470b9b6d767bcfcf5e5292e
commit 58073ccbe358ecc0c470b9b6d767bcfcf5e5292e
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-03-16 15:36:49 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-12-13 16:39:38 +0000
tail: Verify correct behavior when input does not end in a newline.
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D39116
(cherry picked from commit fa3af3ce5010740f28faed22e0a1e819491f26b4)
---
usr.bin/tail/tests/tail_test.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/usr.bin/tail/tests/tail_test.sh b/usr.bin/tail/tests/tail_test.sh
index 0b845dff0cf8..8123a310fe67 100755
--- a/usr.bin/tail/tests/tail_test.sh
+++ b/usr.bin/tail/tests/tail_test.sh
@@ -391,6 +391,19 @@ si_number_body() {
atf_check cmp outfile expectfile
}
+atf_test_case no_lf_at_eof
+no_lf_at_eof_head()
+{
+ atf_set "descr" "File does not end in newline"
+}
+no_lf_at_eof_body()
+{
+ printf "a\nb\nc" >infile
+ atf_check -o inline:"c" tail -1 infile
+ atf_check -o inline:"b\nc" tail -2 infile
+ atf_check -o inline:"a\nb\nc" tail -3 infile
+ atf_check -o inline:"a\nb\nc" tail -4 infile
+}
atf_init_test_cases()
{
@@ -415,4 +428,5 @@ atf_init_test_cases()
atf_add_test_case silent_header
atf_add_test_case verbose_header
atf_add_test_case si_number
+ atf_add_test_case no_lf_at_eof
}