3 # Copyright (C) 1996, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 (my $s = $_[0]) =~ s/:/$delim/g;
33 # flags file-1 file-2 expected output expected return code
35 ['1a', '-a1', ["a 1\n", "b\n"], "a 1\n", 0],
36 ['1b', '-a2', ["a 1\n", "b\n"], "b\n", 0], # Got "\n"
37 ['1c', '-a1 -a2', ["a 1\n", "b\n"], "a 1\nb\n", 0], # Got "a 1\n\n"
38 ['1d', '-a1', ["a 1\nb\n", "b\n"], "a 1\nb\n", 0],
39 ['1e', '-a2', ["a 1\nb\n", "b\n"], "b\n", 0],
40 ['1f', '-a2', ["b\n", "a\nb\n"], "a\nb\n", 0],
42 ['2a', '-a1 -e .', ["a\nb\nc\n", "a x y\nb\nc\n"], "a x y\nb\nc\n", 0],
43 ['2b', '-a1 -e . -o 2.1,2.2,2.3', ["a\nb\nc\n", "a x y\nb\nc\n"],
44 "a x y\nb . .\nc . .\n", 0],
45 ['2c', '-a1 -e . -o 2.1,2.2,2.3', ["a\nb\nc\nd\n", "a x y\nb\nc\n"],
46 "a x y\nb . .\nc . .\n. . .\n", 0],
48 ['3a', '-t:', ["a:1\nb:1\n", "a:2:\nb:2:\n"], "a:1:2:\nb:1:2:\n", 0],
50 # Just like -a1 and -a2 when there are no pairable lines
51 ['4a', '-v 1', ["a 1\n", "b\n"], "a 1\n", 0],
52 ['4b', '-v 2', ["a 1\n", "b\n"], "b\n", 0],
54 ['4c', '-v 1', ["a 1\nb\n", "b\n"], "a 1\n", 0],
55 ['4d', '-v 2', ["a 1\nb\n", "b\n"], "", 0],
56 ['4e', '-v 2', ["b\n", "a 1\nb\n"], "a 1\n", 0],
57 ['5a', '-a1 -e - -o 1.1,2.2',
58 ["a 1\nb 2\n", "a 11\nb\n"], "a 11\nb -\n", 0],
59 ['5b', '-a1 -e - -o 1.1,2.2',
60 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15"],
61 "apr 06\naug 14\ndec -\nfeb 15\n", 0],
62 ['5c', '-a1 -e - -o 1.1,2.2',
63 ["aug 20\ndec 18\n", "aug 14\ndate\nfeb 15"],
64 "aug 14\ndec -\n", 0],
65 ['5d', '-a1 -e - -o 1.1,2.2',
66 ["dec 18\n", ""], "dec -\n", 0],
67 ['5e', '-a2 -e - -o 1.1,2.2',
68 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n"],
69 "apr 06\naug 14\n- -\nfeb 15\n", 0],
70 ['5f', '-a2 -e - -o 2.2,1.1',
71 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n"],
72 "06 apr\n14 aug\n- -\n15 feb\n", 0],
73 ['5g', '-a1 -e - -o 2.2,1.1',
74 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\nfeb 15\n"],
75 "06 apr\n14 aug\n- dec\n15 feb\n", 0],
77 ['5h', '-a1 -e - -o 2.2,1.1',
78 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
79 "06 apr\n14 aug\n- dec\n- feb\n", 0],
80 ['5i', '-a1 -e - -o 1.1,2.2',
81 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
82 "apr 06\naug 14\ndec -\nfeb -\n", 0],
84 ['5j', '-a2 -e - -o 2.2,1.1',
85 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
86 "06 apr\n14 aug\n- -\n", 0],
87 ['5k', '-a2 -e - -o 2.2,1.1',
88 ["apr 15\naug 20\ndec 18\nfeb 05\n", "apr 06\naug 14\ndate\n"],
89 "06 apr\n14 aug\n- -\n", 0],
91 ['5l', '-a1 -e - -o 2.2,1.1',
92 ["apr 15\naug 20\ndec 18\n", "apr 06\naug 14\ndate\nfeb 15\n"],
93 "06 apr\n14 aug\n- dec\n", 0],
94 ['5m', '-a2 -e - -o 2.2,1.1',
95 ["apr 15\naug 20\ndec 18\n", "apr 06\naug 14\ndate\nfeb 15\n"],
96 "06 apr\n14 aug\n- -\n15 -\n", 0],
99 ["a 1\nb 2\nd 4\n", "a 21\nb 22\nc 23\nf 26\n"],
100 "a 1 21\nb 2 22\n", 0],
102 ["a 1\nb 2\nd 4\n", "a 21\nb 22\nc 23\nf 26\n"],
103 "a 1 21\nb 2 22\nd 4\n", 0],
105 ["a 21\nb 22\nc 23\nf 26\n", "a 1\nb 2\nd 4\n"],
106 "a 21 1\nb 22 2\nc 23\nf 26\n", 0],
108 ['7a', '-a1 -e . -o 2.7',
109 ["a\nb\nc\n", "a x y\nb\nc\n"], ".\n.\n.\n", 0],
111 ['8a', '-a1 -e . -o 0,1.2',
112 ["a\nb\nc\nd G\n", "a x y\nb\nc\ne\n"],
113 "a .\nb .\nc .\nd G\n", 0],
114 ['8b', '-a1 -a2 -e . -o 0,1.2',
115 ["a\nb\nc\nd G\n", "a x y\nb\nc\ne\n"],
116 "a .\nb .\nc .\nd G\ne .\n", 0],
119 ['9a', '', [" a 1\n b 2\n", " a Y\n b Z\n"], "a 1 Y\nb 2 Z\n", 0],
121 # From Tim Smithers: fixed in 1.22l
122 ['trailing-sp', '-t: -1 1 -2 1', ["a:x \n", "a:y \n"], "a:x :y \n", 0],
124 # From Paul Eggert: fixed in 1.22n
125 ['sp-vs-blank', '', ["\f 1\n", "\f 2\n"], "\f 1 2\n", 0],
127 # From Paul Eggert: fixed in 1.22n (this would fail on Solaris7,
128 # with LC_ALL set to en_US).
129 # Unfortunately, that Solaris7's en_US local folds case (making
130 # the first input file sorted) is not portable, so this test would
131 # fail on e.g. Linux systems, because the input to join isn't sorted.
132 # ['lc-collate', '', ["a 1a\nB 1B\n", "B 2B\n"], "B 1B 2B\n", 0],
134 # Based on a report from Antonio Rendas. Fixed in 2.0.9.
135 ['8-bit-t', t_subst "-t:",
136 [t_subst "a:1\nb:1\n", t_subst "a:2:\nb:2:\n"],
137 t_subst "a:1:2:\nb:1:2:\n", 0],
139 ['bigfield', '-1 340282366920938463463374607431768211456 -2 2',
140 ["a\n", "b\n"], " a b\n", 0],
142 # FIXME: change this to ensure the diagnostic makes sense
143 ['invalid-j', '-j x', {}, "", 1],