* tests/fmt/basic (pfx-only, pfx-of-pfx): New tests,
authorJim Meyering <jim@meyering.net>
Sat, 6 Jan 2007 09:42:17 +0000 (10:42 +0100)
committerJim Meyering <jim@meyering.net>
Sat, 6 Jan 2007 09:42:17 +0000 (10:42 +0100)
based on examples from G.P. Halkes in
<http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/9388>.

ChangeLog
tests/fmt/basic

index 7fcccc15d0e0843ee82bd006709eb911740ed32d..2ac01ae5735013f0aca0567de10173b956a524db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-01-06  Jim Meyering  <jim@meyering.net>
+
+       * tests/fmt/basic (pfx-only, pfx-of-pfx): New tests,
+       based on examples from G.P. Halkes in
+       <http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/9388>.
+
 2007-01-06  G.P. Halkes  <buscom@ghalkes.nl>
 
        * src/fmt.c (copy_rest): Correct prefix handling.
index 04938b860029a4d494f6935a571839fe0d109552..66abe13057b29304774c07221b81fea81885a496 100755 (executable)
@@ -64,6 +64,18 @@ my @Tests =
      ['pfx-1', qw (-p '>'),
       {IN=>  " 1\n  2\n\t3\n\t\t4\n> quoted\n> text\n"},
       {OUT=> " 1\n  2\n\t3\n\t\t4\n> quoted text\n"}],
+
+     # Don't remove prefix from a prefix-only line.
+     ['pfx-only', qw (-p '>'),
+      {IN=>  ">\n"},
+      {OUT=> ">\n"}],
+
+     # With a multi-byte prefix, say, "foo", don't empty a line that
+     # starts with a strict prefix (e.g. "fo") of that prefix.
+     # With fmt from coreutils-6.7, it would mistakenly output an empty line.
+     ['pfx-of-pfx', qw (-p 'foo'),
+      {IN=>  "fo\n"},
+      {OUT=> "fo\n"}],
 );
 
 my $save_temps = $ENV{DEBUG};