my $nl = "\n";
@Test::t = (
-# test input flags expected output expected return code
+# test flags input expected output expected return code
#
-['1', "a:b:c$nl", '-d: -f1,3-', "a:c\n", 0],
-['2', "a:b:c\n", '-d: -f1,3-', "a:c\n", 0],
-['3', "a:b:c$nl", '-d: -f2-', "b:c\n", 0],
-['4', "a:b:c$nl", '-d: -f4', "\n", 0],
-['5', "", '-d: -f4', "", 0],
-['6', "123$nl", '-c4', "\n", 0],
-['7', "123", '-c4', "\n", 0],
-['8', "123\n1", '-c4', "\n\n", 0],
-['9', "", '-c4', "", 0],
-['a', "a:b:c$nl", '-s -d: -f3-', "c\n", 0],
-['b', "a:b:c$nl", '-s -d: -f2,3', "b:c\n", 0],
-['c', "a:b:c$nl", '-s -d: -f1,3', "a:c\n", 0],
+['1', '-d: -f1,3-', "a:b:c$nl", "a:c\n", 0],
+['2', '-d: -f1,3-', "a:b:c\n", "a:c\n", 0],
+['3', '-d: -f2-', "a:b:c$nl", "b:c\n", 0],
+['4', '-d: -f4', "a:b:c$nl", "\n", 0],
+['5', '-d: -f4', "", "", 0],
+['6', '-c4', "123$nl", "\n", 0],
+['7', '-c4', "123", "\n", 0],
+['8', '-c4', "123\n1", "\n\n", 0],
+['9', '-c4', "", "", 0],
+['a', '-s -d: -f3-', "a:b:c$nl", "c\n", 0],
+['b', '-s -d: -f2,3', "a:b:c$nl", "b:c\n", 0],
+['c', '-s -d: -f1,3', "a:b:c$nl", "a:c\n", 0],
# Trailing colon should not be output
-['d', "a:b:c:$nl", '-s -d: -f1,3', "a:c\n", 0],
-['e', "a:b:c:$nl", '-s -d: -f3-', "c:\n", 0],
-['f', "a:b:c:$nl", '-s -d: -f3-4', "c:\n", 0],
-['g', "a:b:c:$nl", '-s -d: -f3,4', "c:\n", 0],
+['d', '-s -d: -f1,3', "a:b:c:$nl", "a:c\n", 0],
+['e', '-s -d: -f3-', "a:b:c:$nl", "c:\n", 0],
+['f', '-s -d: -f3-4', "a:b:c:$nl", "c:\n", 0],
+['g', '-s -d: -f3,4', "a:b:c:$nl", "c:\n", 0],
# Make sure -s suppresses non-delimited lines
-['h', "abc\n", '-s -d: -f2,3', "", 0],
+['h', '-s -d: -f2,3', "abc\n", "", 0],
#
-['i', ":::\n", '-d: -f1-3', "::\n", 0],
-['j', ":::\n", '-d: -f1-4', ":::\n", 0],
-['k', ":::\n", '-d: -f2-3', ":\n", 0],
-['l', ":::\n", '-d: -f2-4', "::\n", 0],
-['m', ":::\n", '-s -d: -f1-3', "::\n", 0],
-['n', ":::\n", '-s -d: -f1-4', ":::\n", 0],
-['o', ":::\n", '-s -d: -f2-3', ":\n", 0],
-['p', ":::\n", '-s -d: -f2-4', "::\n", 0],
-['q', ":::\n:\n", '-s -d: -f2-4', "::\n\n", 0],
-['r', ":::\n:1\n", '-s -d: -f2-4', "::\n1\n", 0],
-['s', ":::\n:a\n", '-s -d: -f1-4', ":::\n:a\n", 0],
-['t', ":::\n:1\n", '-s -d: -f3-', ":\n\n", 0],
+['i', '-d: -f1-3', ":::\n", "::\n", 0],
+['j', '-d: -f1-4', ":::\n", ":::\n", 0],
+['k', '-d: -f2-3', ":::\n", ":\n", 0],
+['l', '-d: -f2-4', ":::\n", "::\n", 0],
+['m', '-s -d: -f1-3', ":::\n", "::\n", 0],
+['n', '-s -d: -f1-4', ":::\n", ":::\n", 0],
+['o', '-s -d: -f2-3', ":::\n", ":\n", 0],
+['p', '-s -d: -f2-4', ":::\n", "::\n", 0],
+['q', '-s -d: -f2-4', ":::\n:\n", "::\n\n", 0],
+['r', '-s -d: -f2-4', ":::\n:1\n", "::\n1\n", 0],
+['s', '-s -d: -f1-4', ":::\n:a\n", ":::\n:a\n", 0],
+['t', '-s -d: -f3-', ":::\n:1\n", ":\n\n", 0],
# Make sure it handles empty input properly, with and without -s.
-['u', "", '-s -f3-', "", 0],
-['v', "", '-f3-', "", 0],
+['u', '-s -f3-', "", "", 0],
+['v', '-f3-', "", "", 0],
# Make sure it handles empty input properly.
-['w', "", '-b 1', "", 0],
-['x', ":\n", '-s -d: -f2-4', "\n", 0],
+['w', '-b 1', "", "", 0],
+['x', '-s -d: -f2-4', ":\n", "\n", 0],
# Errors
# -s may be used only with -f
-['y', ":\n", '-s -b4', "", 1],
+['y', '-s -b4', ":\n", "", 1],
# You must specify bytes or fields (or chars)
-['z', ":\n", '', "", 1],
+['z', '', ":\n", "", 1],
# Empty field list
-['A', ":\n", '-f \'\'', "", 1],
+['A', '-f \'\'', ":\n", "", 1],
# Missing field list
-['B', ":\n", '-f', "", 1],
+['B', '-f', ":\n", "", 1],
# Empty byte list
-['C', ":\n", '-b \'\'', "", 1],
+['C', '-b \'\'', ":\n", "", 1],
# Missing byte list
-['D', ":\n", '-b', "", 1],
+['D', '-b', ":\n", "", 1],
);
1;