summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2007-04-12 00:21:25 +0200
committerJim Meyering <jim@meyering.net>2007-04-12 00:21:25 +0200
commit395fcee97a358fdfe2d6ca3bc2544cb008fd40f6 (patch)
treee967bcf7d0781bf5bc8e82e3864639f71dca79b2 /tests/misc
parentf839bfad730f49d162213fe313b47319bd74b9d3 (diff)
downloadcoreutils-395fcee97a358fdfe2d6ca3bc2544cb008fd40f6.tar.xz
split --line-bytes=N (-C N): don't create an empty file.
* src/split.c (line_bytes_split): Don't create an empty line afterwards if the last buffer happens to be exactly full. * tests/misc/split-fail: Add a test case for this. * NEWS: mention this.
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/split-fail8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/misc/split-fail b/tests/misc/split-fail
index 70435b453..8cdfe6478 100755
--- a/tests/misc/split-fail
+++ b/tests/misc/split-fail
@@ -1,7 +1,7 @@
#!/bin/sh
# split must fail when given length/count of zero.
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2007 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
@@ -47,6 +47,12 @@ split -b 0 in 2> /dev/null && fail=1
split -C 0 in 2> /dev/null && fail=1
split -l 0 in 2> /dev/null && fail=1
+# Make sure -C doesn't create empty files.
+rm -f x?? || fail=1
+echo x | split -C 1 || fail=1
+test -f xaa && test -f xab || fail=1
+test -f xac && fail=1
+
# Make sure that the obsolete -N notation still works
split -1 in 2> /dev/null || fail=1