summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2010-02-01 15:19:08 +0000
committerPádraig Brady <P@draigBrady.com>2010-02-01 15:36:56 +0000
commitf86bb6967dba1e2b6026997963a90e00cd641490 (patch)
tree0b4451e967924bfba4c42f9c819c0e33b1b53c95 /tests
parent819aa9eba741c36bb522cbc2c7f10e24d190f945 (diff)
downloadcoreutils-f86bb6967dba1e2b6026997963a90e00cd641490.tar.xz
join: make -t '' operate on the whole line
Previously passing an empty parameter to -t would raise an error, but now it means to treat each line as a single field for matching. This matches the default operation of `sort` which is usually used in conjunction with join. * src/join.c (main): Set the field delimiter to '\n' if an empty parameter is passed to -t. (usage): Mention the operation of -t ''. * tests/misc/join: Add 2 new tests, for the existing -t '\0' and the new -t '' functionality. * doc/coreutils.texi (join invocation): Mention that join -t '' always operates on the whole line, while join -t '\0' usually does. * NEWS: Mention the change in behavior.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/join5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/misc/join b/tests/misc/join
index 4e7798fd9..cef813773 100755
--- a/tests/misc/join
+++ b/tests/misc/join
@@ -51,6 +51,11 @@ my @tv = (
['3a', '-t:', ["a:1\nb:1\n", "a:2:\nb:2:\n"], "a:1:2:\nb:1:2:\n", 0],
+# operate on whole line (as sort does by default)
+['3b', '-t ""', ["a 1\nb 1\n", "a 1\nb 2\n"], "a 1\n", 0],
+# use NUL as the field delimiter
+['3c', '-t "\\0"', ["a\0a\n", "a\0b\n"], "a\0a\0b\n", 0],
+
# Just like -a1 and -a2 when there are no pairable lines
['4a', '-v 1', ["a 1\n", "b\n"], "a 1\n", 0],
['4b', '-v 2', ["a 1\n", "b\n"], "b\n", 0],