]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: add a test for newly-fixed bug in comm --check-order
authorJim Meyering <meyering@redhat.com>
Sun, 8 Mar 2009 17:37:08 +0000 (18:37 +0100)
committerJim Meyering <meyering@redhat.com>
Sun, 8 Mar 2009 20:34:08 +0000 (21:34 +0100)
* tests/misc/comm (ooo-prefix): Add a test for today's fix.
* NEWS (Bug fixes): Mention it.

NEWS
tests/misc/comm

diff --git a/NEWS b/NEWS
index 63c7e19dd73791324945c11ac8a3ee200e05ca5a..fd101a40060b8bb2b9185da418c80b751100bffe 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,11 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 ** Bug fixes
 
+  comm's new --check-order option would fail to detect disorder on any pair
+  of lines where one was a prefix of the other.  For example, this would
+  fail to report the disorder: printf 'Xb\nX\n'>k; comm --check-order k k
+  [bug introduced in coreutils-7.0]
+
   cp once again diagnoses the invalid "cp -rl dir dir" right away,
   rather than after creating a very deep dir/dir/dir/... hierarchy.
   The bug strikes only with both --recursive (-r, -R) and --link (-l).
index 81a8529449c9b217c76c72f819dacd93162056df..80a0c2dd39e2391de91a8bb56e452ca45e220bbf 100755 (executable)
@@ -2,7 +2,7 @@
 # -*- perl -*-
 # Test comm
 
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008-2009 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -116,6 +116,13 @@ my @Tests =
     {OUT => "\t\t2\n"},
     {ERR => "$prog: file 1 is not in sorted order\n"}],
 
+   # out-of-order, line 2 is a prefix of line 1
+   # until coreutils-7.2, this test would fail -- no disorder detected
+   ['ooo-prefix', '--check-order', {IN=>{a=>"Xa\nX\n"}}, {IN=>{b=>""}},
+    {EXIT=>1},
+    {OUT => "Xa\n"},
+    {ERR => "$prog: file 1 is not in sorted order\n"}],
+
    # alternate delimiter: ','
    ['delim-comma', '--output-delimiter=,', @inputs,
     {OUT=>"1\n,2\n,,3\n"} ],