column: add columnar layout
[git.git] / t / t9002-column.sh
blobec288aeb95e70d9f9e47ce28284a89b8497d0bca
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 test_expect_success 'COLUMNS = 1' '
54 cat >expected <<\EOF &&
55 one
56 two
57 three
58 four
59 five
60 six
61 seven
62 eight
63 nine
64 ten
65 eleven
66 EOF
67 COLUMNS=1 git column --mode=column <lista >actual &&
68 test_cmp expected actual
71 test_expect_success 'width = 1' '
72 git column --mode=column --width=1 <lista >actual &&
73 test_cmp expected actual
76 COLUMNS=20
77 export COLUMNS
79 test_expect_success '20 columns' '
80 cat >expected <<\EOF &&
81 one seven
82 two eight
83 three nine
84 four ten
85 five eleven
86 six
87 EOF
88 git column --mode=column <lista >actual &&
89 test_cmp expected actual
92 test_expect_success '20 columns, padding 2' '
93 cat >expected <<\EOF &&
94 one seven
95 two eight
96 three nine
97 four ten
98 five eleven
99 six
101 git column --mode=column --padding 2 <lista >actual &&
102 test_cmp expected actual
105 test_expect_success '20 columns, indented' '
106 cat >expected <<\EOF &&
107 one seven
108 two eight
109 three nine
110 four ten
111 five eleven
114 git column --mode=column --indent=" " <lista >actual &&
115 test_cmp expected actual
118 test_expect_success '20 columns, row first' '
119 cat >expected <<\EOF &&
120 one two
121 three four
122 five six
123 seven eight
124 nine ten
125 eleven
127 git column --mode=row <lista >actual &&
128 test_cmp expected actual
131 test_done