Debian Codegraph @

cli-color/test/columns.js

raw
1 "use strict";
2
3 module.exports = function (t, a) {
4 a(t([]), "\n", "Empty #1");
5 a(t([[], [], []]), "\n\n\n", "Empty #2");
6
7 a(t([["A", "BC", "DEF"]]), "A | BC | DEF\n", "Header Only");
8
9 a(
10 t([
11 ["A", "BC", "DEF"], [1, 23, 456]
12 ]),
13 "A | BC | DEF\n1 | 23 | 456\n",
14 "Small items"
15 );
16 a(
17 t([
18 ["A", "BC", "DEF"], [12, 234, 4567]
19 ]),
20 "A | BC | DEF \n12 | 234 | 4567\n",
21 "Large items"
22 );
23 a(
24 t([
25 ["A", "BC", "DEF"], [1234, 23456, 456789]
26 ]),
27 "A | BC | DEF \n1234 | 23456 | 456789\n",
28 "Very large items"
29 );
30
31 a(t([["A"], [1], [23], [456]]), "A \n1 \n23 \n456\n", "Single column");
32
33 a(t([["ID"], [1], [1, 23], [1, 23, 456]]), "ID\n1 \n1 | 23\n1 | 23 | 456\n", "Force columns");
34
35 a(
36 t([
37 ["ONE", "TWO", "THREE"], ["ON", "DWA\nTRZY", "DWA\nTRZY\nCZTERY"], ["HOPLA", "B", "C"]
38 ]),
39 "ONE | TWO | THREE \nON | DWA | DWA \n | TRZY | TRZY \n" +
40 " | | CZTERY\nHOPLA | B | C \n",
41 "Rows"
42 );
43
44 a(t([["ID"], ["", ""], [123, 123]]), "ID \n | \n123 | 123\n", "Empty cells");
45 };