interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / complete_sql.sql

117 lines · 2400 bytes Raw Blame History
1#!sqlite3
2#
3# 2026-10-08
4#
5# The author disclaims copyright to this source code. In place of
6# a legal notice, here is a blessing:
7#
8# May you do good and not evil.
9# May you find forgiveness for yourself and forgive others.
10# May you share freely, never taking more than you give.
11#
12#***********************************************************************
13#
14# Test cases for the "shell_complete_sql()" function in the CLI.
15#
16# ./sqlite3 test/complete_sql.sql
17#
18#
19.open :memory:
20.mode -reset test
21.testcase 100
22.mode line --limits off
23SELECT shell_complete_sql('CREATE TABLE t1(a) /*') AS out;
24.check <<END
25out: CREATE TABLE t1(a) /**/
26END
27
28.testcase 110
29SELECT shell_complete_sql('CREATE TABLE t1(a) --') AS out;
30.check <<END
31out: CREATE TABLE t1(a) --
32
33END
34
35.testcase 120
36SELECT shell_complete_sql('CREATE TABLE t1(a CHECK(a<>''/*''))') AS out;
37.check <<END
38out: CREATE TABLE t1(a CHECK(a<>'/*'))
39END
40
41.testcase 130
42SELECT shell_complete_sql('CREATE TABLE t1(a) ''one') AS out;
43.check <<END
44out: CREATE TABLE t1(a) 'one'
45END
46
47.testcase 140
48SELECT shell_complete_sql('CREATE TABLE t1(a) "one') AS out;
49.check <<END
50out: CREATE TABLE t1(a) "one"
51END
52
53.testcase 150
54SELECT shell_complete_sql('CREATE TABLE t1(a) `one') AS out;
55.check <<END
56out: CREATE TABLE t1(a) `one`
57END
58
59.testcase 160
60SELECT shell_complete_sql('CREATE TABLE t1(a) [one') AS out;
61.check <<END
62out: CREATE TABLE t1(a) [one]
63END
64
65.testcase 170
66SELECT shell_complete_sql('CREATE TRIGGER t1(a) [one') AS out;
67.check <<END
68out: CREATE TRIGGER t1(a) [one];END
69END
70
71.testcase 180
72SELECT shell_complete_sql('CREATE TRIGGER t1(a) [one]') AS out;
73.check <<END
74out: CREATE TRIGGER t1(a) [one];END
75END
76
77.testcase 190
78SELECT shell_complete_sql('CREATE TRIGGER t1(a) [one];') AS out;
79.check <<END
80out: CREATE TRIGGER t1(a) [one];END
81END
82
83.testcase 200
84SELECT shell_complete_sql('CREATE TABLE t1(a);') AS out;
85.check <<END
86out: CREATE TABLE t1(a);
87END
88
89.testcase 210
90SELECT shell_complete_sql(' ') AS out;
91.check <<END
92out:
93END
94
95.testcase 220
96SELECT shell_complete_sql(' /* only') AS out;
97.check <<END
98out: /* only*/
99END
100
101.testcase 300
102SELECT shell_complete_sql('SELECT (((''',1) AS out;
103.check <<END
104out: SELECT ((('')));
105END
106
107.testcase 310
108SELECT shell_complete_sql('SELECT (((/*',1) AS out;
109.check <<END
110out: SELECT (((/**/)));
111END
112
113.testcase 320
114SELECT shell_complete_sql('SELECT (((/*',3) AS out;
115.check <<END
116out: */)));
117END