Merge branch 'ds/reprepare-alternates-when-repreparing-packfiles'
[alt-git.git] / t / t9002-column.sh
blob6d3dbde3feb9a41dc59a42f75ef578b1ebc5b183
1 #!/bin/sh
3 test_description='git column'
4 . ./test-lib.sh
6 test_expect_success 'setup' '
7 cat >lista <<\EOF
8 one
9 two
10 three
11 four
12 five
13 six
14 seven
15 eight
16 nine
17 ten
18 eleven
19 EOF
22 test_expect_success 'never' '
23 git column --indent=Z --mode=never <lista >actual &&
24 test_cmp lista actual
27 test_expect_success 'always' '
28 cat >expected <<\EOF &&
29 Zone
30 Ztwo
31 Zthree
32 Zfour
33 Zfive
34 Zsix
35 Zseven
36 Zeight
37 Znine
38 Zten
39 Zeleven
40 EOF
41 git column --indent=Z --mode=plain <lista >actual &&
42 test_cmp expected actual
45 test_expect_success '--nl' '
46 cat >expected <<\EOF &&
47 oneZ
48 twoZ
49 threeZ
50 fourZ
51 fiveZ
52 sixZ
53 sevenZ
54 eightZ
55 nineZ
56 tenZ
57 elevenZ
58 EOF
59 git column --nl="Z$LF" --mode=plain <lista >actual &&
60 test_cmp expected actual
63 test_expect_success '80 columns' '
64 cat >expected <<\EOF &&
65 one two three four five six seven eight nine ten eleven
66 EOF
67 COLUMNS=80 git column --mode=column <lista >actual &&
68 test_cmp expected actual
71 cat >expected <<\EOF
72 one
73 two
74 three
75 four
76 five
77 six
78 seven
79 eight
80 nine
81 ten
82 eleven
83 EOF
85 test_expect_success COLUMNS_CAN_BE_1 'COLUMNS = 1' '
86 COLUMNS=1 git column --mode=column <lista >actual &&
87 test_cmp expected actual
90 test_expect_success 'width = 1' '
91 git column --mode=column --width=1 <lista >actual &&
92 test_cmp expected actual
95 COLUMNS=20
96 export COLUMNS
98 test_expect_success '20 columns' '
99 cat >expected <<\EOF &&
100 one seven
101 two eight
102 three nine
103 four ten
104 five eleven
107 git column --mode=column <lista >actual &&
108 test_cmp expected actual
111 test_expect_success '20 columns, nodense' '
112 cat >expected <<\EOF &&
113 one seven
114 two eight
115 three nine
116 four ten
117 five eleven
120 git column --mode=column,nodense < lista > actual &&
121 test_cmp expected actual
124 test_expect_success '20 columns, dense' '
125 cat >expected <<\EOF &&
126 one five nine
127 two six ten
128 three seven eleven
129 four eight
131 git column --mode=column,dense < lista > actual &&
132 test_cmp expected actual
135 test_expect_success '20 columns, padding 2' '
136 cat >expected <<\EOF &&
137 one seven
138 two eight
139 three nine
140 four ten
141 five eleven
144 git column --mode=column --padding 2 <lista >actual &&
145 test_cmp expected actual
148 test_expect_success '20 columns, indented' '
149 cat >expected <<\EOF &&
150 one seven
151 two eight
152 three nine
153 four ten
154 five eleven
157 git column --mode=column --indent=" " <lista >actual &&
158 test_cmp expected actual
161 test_expect_success '20 columns, row first' '
162 cat >expected <<\EOF &&
163 one two
164 three four
165 five six
166 seven eight
167 nine ten
168 eleven
170 git column --mode=row <lista >actual &&
171 test_cmp expected actual
174 test_expect_success '20 columns, row first, nodense' '
175 cat >expected <<\EOF &&
176 one two
177 three four
178 five six
179 seven eight
180 nine ten
181 eleven
183 git column --mode=row,nodense <lista >actual &&
184 test_cmp expected actual
187 test_expect_success '20 columns, row first, dense' '
188 cat >expected <<\EOF &&
189 one two three
190 four five six
191 seven eight nine
192 ten eleven
194 git column --mode=row,dense <lista >actual &&
195 test_cmp expected actual
198 test_done