Debian Codegraph @

test/vt100-a.sql

raw
1 /*
2 ** Run this script using the "sqlite3" command-line shell
3 ** test test formatting of output text that contains
4 ** vt100 escape sequences.
5 */
6 .mode box -escape off
7 CREATE TEMP TABLE t1(a,b,c);
8 INSERT INTO t1 VALUES
9 ('one','twotwotwo','thirty-three'),
10 (unistr('\u001b[91mRED\u001b[0m'),'fourfour','fifty-five'),
11 ('six','seven','eighty-eight');
12 .testcase 100
13 SELECT * FROM t1;
14 .check <<END
15 ╭─────┬───────────┬──────────────╮
16 │ a │ b │ c │
17 ╞═════╪═══════════╪══════════════╡
18 │ one │ twotwotwo │ thirty-three │
19 │ RED │ fourfour │ fifty-five │
20 │ six │ seven │ eighty-eight │
21 ╰─────┴───────────┴──────────────╯
22 END
23
24 .mode box -escape ascii
25 .testcase 200
26 SELECT * FROM t1;
27 .check <<END
28 ╭────────────────┬───────────┬──────────────╮
29 │ a │ b │ c │
30 ╞════════════════╪═══════════╪══════════════╡
31 │ one │ twotwotwo │ thirty-three │
32 │ ^[[91mRED^[[0m │ fourfour │ fifty-five │
33 │ six │ seven │ eighty-eight │
34 ╰────────────────┴───────────┴──────────────╯
35 END
36
37 .testcase 300
38 .mode box -escape symbol
39 SELECT * FROM t1;
40 .check <<END
41 ╭──────────────┬───────────┬──────────────╮
42 │ a │ b │ c │
43 ╞══════════════╪═══════════╪══════════════╡
44 │ one │ twotwotwo │ thirty-three │
45 │ ␛[91mRED␛[0m │ fourfour │ fifty-five │
46 │ six │ seven │ eighty-eight │
47 ╰──────────────┴───────────┴──────────────╯
48 END