Debian Codegraph @

test/features/iocommands.feature

raw
1 Feature: I/O commands
2
3 @skip_ci
4 Scenario: edit sql in file with external editor
5 When we start external editor providing a file name
6 and we type "select * from abc" in the editor
7 and we exit the editor
8 then we see dbcli prompt
9 and we see "select * from abc" in prompt
10
11 Scenario: tee output from query
12 When we tee output
13 and we wait for prompt
14 and we select "select 123456"
15 and we wait for prompt
16 and we notee output
17 and we wait for prompt
18 then we see 123456 in tee output
19
20 Scenario: set delimiter
21 When we query "delimiter $"
22 then delimiter is set to "$"
23
24 Scenario: set delimiter twice
25 When we query "delimiter $"
26 and we query "delimiter ]]"
27 then delimiter is set to "]]"
28
29 Scenario: set delimiter and query on same line
30 When we query "select 123; delimiter $ select 456 $ delimiter %"
31 then we see tabular result "123"
32 and we see tabular result "456"
33 and delimiter is set to "%"
34
35 Scenario: send output to file
36 When we query "\o /tmp/output1.sql"
37 and we query "select 123"
38 and we query "system cat /tmp/output1.sql"
39 then we see csv result "123"
40
41 Scenario: send output to file two times
42 When we query "\o /tmp/output1.sql"
43 and we query "select 123"
44 and we query "\o /tmp/output2.sql"
45 and we query "select 456"
46 and we query "system cat /tmp/output2.sql"
47 then we see csv result "456"
48
49 Scenario: shell style redirect to file
50 When we query "select 123 as constant $> /tmp/output1.csv"
51 and we query "system cat /tmp/output1.csv"
52 then we see csv 123 in file output
53
54 Scenario: shell style redirect to command
55 When we query "select 100 $| wc"
56 then we see space 12 in command output
57
58 Scenario: shell style redirect to multiple commands
59 When we query "select 100 $| head -1 $| wc"
60 then we see space 6 in command output
61
62 Scenario: shell style redirect to multiple commands with minimal spaces
63 When we query "select 100$|head -1$|wc"
64 then we see space 6 in command output
65
66 Scenario: shell style redirect to multiple commands containing single quotes
67 When we query "select 100 $| head '-1' $| wc"
68 then we see space 6 in command output
69
70 Scenario: shell style redirect to multiple commands containing single quotes and minimal spaces
71 When we query "select 100$|head '-1'$|wc"
72 then we see space 6 in command output
73
74 Scenario: shell style redirect to multiple commands containing mixed quoted and unquoted arg
75 When we query "select 100 $| head -'1' $| wc"
76 then we see space 6 in command output
77
78 Scenario: shell style redirect to multiple commands containing double quotes
79 When we query "select 100 $| head ""-1"" $| wc"
80 then we see space 6 in command output
81
82 Scenario: shell style redirect with commands and capture to file
83 When we query "select 100 $| head -1 $| wc $> /tmp/output1.txt"
84 and we query "system cat /tmp/output1.txt"
85 then we see text 6 in file output
86
87 Scenario: shell style redirect with append to file
88 When we query "select 100 $> /tmp/output1.csv"
89 and we query "select 200 $>> /tmp/output1.csv"
90 and we query "system cat /tmp/output1.csv"
91 then we see csv 100 in file output
92 and we see csv 200 in file output
93
94 Scenario: shell style redirect with command and append to file
95 When we query "select 300 $| grep 0 $> /tmp/output1.csv"
96 and we query "select 400 $| grep 0 $>> /tmp/output1.csv"
97 and we query "system cat /tmp/output1.csv"
98 then we see csv 300 in file output
99 and we see csv 400 in file output