aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/analyzer1.test39
-rw-r--r--test/jrnlmode.test1
-rw-r--r--test/select4.test3
-rw-r--r--test/sqldiff1.test57
-rw-r--r--test/stat.test10
5 files changed, 107 insertions, 3 deletions
diff --git a/test/analyzer1.test b/test/analyzer1.test
new file mode 100644
index 000000000..9eac241d2
--- /dev/null
+++ b/test/analyzer1.test
@@ -0,0 +1,39 @@
+# 2015-05-11
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# Quick tests for the sqlite3_analyzer tool
+#
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+if {$tcl_platform(platform)=="windows"} {
+ set PROG "sqlite3_analyzer.exe"
+} else {
+ set PROG "./sqlite3_analyzer"
+}
+db close
+forcedelete test.db test.db-journal test.db-wal
+sqlite3 db test.db
+
+do_test analyzer1-1.0 {
+ db eval {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
+ CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
+ WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<250)
+ INSERT INTO t1(a,b) SELECT x, randomblob(200) FROM c;
+ INSERT INTO t2(a,b) SELECT a, b FROM t1;
+ }
+ set line "exec $PROG test.db"
+ unset -nocomplain ::MSG
+ catch {eval $line} ::MSG
+} {0}
+do_test analyzer1-1.1 {
+ regexp {^/\*\* Disk-Space Utilization.*COMMIT;\W*$} $::MSG
+} {1}
diff --git a/test/jrnlmode.test b/test/jrnlmode.test
index cebbfe563..2ba56f2b0 100644
--- a/test/jrnlmode.test
+++ b/test/jrnlmode.test
@@ -559,7 +559,6 @@ do_execsql_test jrnlmode-8.30 { PRAGMA journal_mode=DELETE } {delete}
do_test jrnlmode-9.1 {
forcedelete test2.db
sqlite3 db2 test2.db
- breakpoint
db2 eval {CREATE TEMP TABLE t(l); PRAGMA journal_mode=off;}
db2 close
} {}
diff --git a/test/select4.test b/test/select4.test
index a1619e59c..c0f88a150 100644
--- a/test/select4.test
+++ b/test/select4.test
@@ -158,6 +158,9 @@ do_test select4-2.4 {
}} msg]
lappend v $msg
} {1 {ORDER BY clause should come after UNION not before}}
+do_execsql_test select4-2.5 {
+ SELECT 123 AS x ORDER BY (SELECT x ORDER BY 1);
+} {123}
# Except operator
#
diff --git a/test/sqldiff1.test b/test/sqldiff1.test
new file mode 100644
index 000000000..4f4cd7082
--- /dev/null
+++ b/test/sqldiff1.test
@@ -0,0 +1,57 @@
+# 2015-05-11
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# Quick tests for the sqldiff tool
+#
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+if {$tcl_platform(platform)=="windows"} {
+ set PROG "sqldiff.exe"
+} else {
+ set PROG "./sqldiff"
+}
+db close
+forcedelete test.db test2.db
+sqlite3 db test.db
+
+do_test sqldiff-1.0 {
+ db eval {
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
+ CREATE TABLE t2(a INT PRIMARY KEY, b) WITHOUT ROWID;
+ WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<100)
+ INSERT INTO t1(a,b) SELECT x, printf('abc-%d-xyz',x) FROM c;
+ INSERT INTO t2(a,b) SELECT a, b FROM t1;
+ }
+ db backup test2.db
+ db eval {
+ ATTACH 'test2.db' AS x2;
+ DELETE FROM x2.t1 WHERE a=49;
+ DELETE FROM x2.t2 WHERE a=48;
+ INSERT INTO x2.t1(a,b) VALUES(1234,'hello');
+ INSERT INTO x2.t2(a,b) VALUES(50.5,'xyzzy');
+ CREATE TABLE x2.t3(a,b,c);
+ INSERT INTO x2.t3 VALUES(111,222,333);
+ CREATE TABLE main.t4(x,y,z);
+ INSERT INTO t4 SELECT * FROM t3;
+ }
+ set line "exec $PROG test.db test2.db"
+ unset -nocomplain ::MSG
+ catch {eval $line} ::MSG
+} {0}
+do_test sqldiff-1.1 {
+ set ::MSG
+} {DELETE FROM t1 WHERE a=49;
+INSERT INTO t1(a,b) VALUES(1234,'hello');
+DELETE FROM t2 WHERE a=48;
+INSERT INTO t2(a,b) VALUES(50.5,'xyzzy');
+CREATE TABLE t3(a,b,c);
+INSERT INTO t3(rowid,a,b,c) VALUES(1,111,222,333);
+DROP TABLE t4;}
diff --git a/test/stat.test b/test/stat.test
index f0447e450..57c1b9eae 100644
--- a/test/stat.test
+++ b/test/stat.test
@@ -166,8 +166,10 @@ sqlite3 db test.db
register_dbstat_vtab db
do_execsql_test stat-5.1 {
PRAGMA auto_vacuum = OFF;
- CREATE VIRTUAL TABLE temp.stat USING dbstat;
- CREATE TABLE t1(x);
+ CREATE TABLE tx(y);
+ ATTACH ':memory:' AS aux1;
+ CREATE VIRTUAL TABLE temp.stat USING dbstat(aux1);
+ CREATE TABLE aux1.t1(x);
INSERT INTO t1 VALUES(zeroblob(1513));
INSERT INTO t1 VALUES(zeroblob(1514));
SELECT name, path, pageno, pagetype, ncell, payload, unused, mx_payload
@@ -178,4 +180,8 @@ do_execsql_test stat-5.1 {
t1 /001+000000 4 overflow 0 1020 0 0 \
]
+do_catchsql_test stat-6.1 {
+ CREATE VIRTUAL TABLE temp.s2 USING dbstat(mainx);
+} {1 {no such database: mainx}}
+
finish_test