]>
Commit | Line | Data |
---|---|---|
7e29b825 NTND |
1 | #!/bin/sh |
2 | ||
3 | test_description='git column' | |
4 | . ./test-lib.sh | |
5 | ||
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 | |
20 | ' | |
21 | ||
22 | test_expect_success 'never' ' | |
23 | git column --indent=Z --mode=never <lista >actual && | |
24 | test_cmp lista actual | |
25 | ' | |
26 | ||
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 | |
43 | ' | |
44 | ||
077539d7 NTND |
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 | |
51 | ' | |
52 | ||
f78b1c5f | 53 | cat >expected <<\EOF |
077539d7 NTND |
54 | one |
55 | two | |
56 | three | |
57 | four | |
58 | five | |
59 | six | |
60 | seven | |
61 | eight | |
62 | nine | |
63 | ten | |
64 | eleven | |
65 | EOF | |
f78b1c5f ZJS |
66 | |
67 | test_expect_success COLUMNS_CAN_BE_1 'COLUMNS = 1' ' | |
077539d7 NTND |
68 | COLUMNS=1 git column --mode=column <lista >actual && |
69 | test_cmp expected actual | |
70 | ' | |
71 | ||
72 | test_expect_success 'width = 1' ' | |
73 | git column --mode=column --width=1 <lista >actual && | |
74 | test_cmp expected actual | |
75 | ' | |
76 | ||
77 | COLUMNS=20 | |
78 | export COLUMNS | |
79 | ||
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 | |
91 | ' | |
92 | ||
3f8eccbe NTND |
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 | |
100 | six | |
101 | EOF | |
102 | git column --mode=column,nodense < lista > actual && | |
103 | test_cmp expected actual | |
104 | ' | |
105 | ||
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 | |
112 | EOF | |
113 | git column --mode=column,dense < lista > actual && | |
114 | test_cmp expected actual | |
115 | ' | |
116 | ||
077539d7 NTND |
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 | |
124 | six | |
125 | EOF | |
126 | git column --mode=column --padding 2 <lista >actual && | |
127 | test_cmp expected actual | |
128 | ' | |
129 | ||
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 | |
137 | six | |
138 | EOF | |
139 | git column --mode=column --indent=" " <lista >actual && | |
140 | test_cmp expected actual | |
141 | ' | |
142 | ||
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 | |
151 | EOF | |
152 | git column --mode=row <lista >actual && | |
153 | test_cmp expected actual | |
154 | ' | |
155 | ||
3f8eccbe NTND |
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 | |
164 | EOF | |
165 | git column --mode=row,nodense <lista >actual && | |
166 | test_cmp expected actual | |
167 | ' | |
168 | ||
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 | |
175 | EOF | |
176 | git column --mode=row,dense <lista >actual && | |
177 | test_cmp expected actual | |
178 | ' | |
179 | ||
7e29b825 | 180 | test_done |