Merge branch 'jk/alt-odb-cleanup' into jk/quote-env-path-list-component
[alt-git.git] / t / t9002-column.sh
blob89983527b62f1d6c330edaf2f50c70ce735b0c1e
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 '80 columns' '
46 cat >expected <<\EOF &&
47 one two three four five six seven eight nine ten eleven
48 EOF
49 COLUMNS=80 git column --mode=column <lista >actual &&
50 test_cmp expected actual
53 cat >expected <<\EOF
54 one
55 two
56 three
57 four
58 five
59 six
60 seven
61 eight
62 nine
63 ten
64 eleven
65 EOF
67 test_expect_success COLUMNS_CAN_BE_1 'COLUMNS = 1' '
68 COLUMNS=1 git column --mode=column <lista >actual &&
69 test_cmp expected actual
72 test_expect_success 'width = 1' '
73 git column --mode=column --width=1 <lista >actual &&
74 test_cmp expected actual
77 COLUMNS=20
78 export COLUMNS
80 test_expect_success '20 columns' '
81 cat >expected <<\EOF &&
82 one seven
83 two eight
84 three nine
85 four ten
86 five eleven
87 six
88 EOF
89 git column --mode=column <lista >actual &&
90 test_cmp expected actual
93 test_expect_success '20 columns, nodense' '
94 cat >expected <<\EOF &&
95 one seven
96 two eight
97 three nine
98 four ten
99 five eleven
102 git column --mode=column,nodense < lista > actual &&
103 test_cmp expected actual
106 test_expect_success '20 columns, dense' '
107 cat >expected <<\EOF &&
108 one five nine
109 two six ten
110 three seven eleven
111 four eight
113 git column --mode=column,dense < lista > actual &&
114 test_cmp expected actual
117 test_expect_success '20 columns, padding 2' '
118 cat >expected <<\EOF &&
119 one seven
120 two eight
121 three nine
122 four ten
123 five eleven
126 git column --mode=column --padding 2 <lista >actual &&
127 test_cmp expected actual
130 test_expect_success '20 columns, indented' '
131 cat >expected <<\EOF &&
132 one seven
133 two eight
134 three nine
135 four ten
136 five eleven
139 git column --mode=column --indent=" " <lista >actual &&
140 test_cmp expected actual
143 test_expect_success '20 columns, row first' '
144 cat >expected <<\EOF &&
145 one two
146 three four
147 five six
148 seven eight
149 nine ten
150 eleven
152 git column --mode=row <lista >actual &&
153 test_cmp expected actual
156 test_expect_success '20 columns, row first, nodense' '
157 cat >expected <<\EOF &&
158 one two
159 three four
160 five six
161 seven eight
162 nine ten
163 eleven
165 git column --mode=row,nodense <lista >actual &&
166 test_cmp expected actual
169 test_expect_success '20 columns, row first, dense' '
170 cat >expected <<\EOF &&
171 one two three
172 four five six
173 seven eight nine
174 ten eleven
176 git column --mode=row,dense <lista >actual &&
177 test_cmp expected actual
180 test_done