aboutsummaryrefslogtreecommitdiff
path: root/test/sqldiff1.test
diff options
context:
space:
mode:
authordan <dan@noemail.net>2015-05-11 18:46:42 +0000
committerdan <dan@noemail.net>2015-05-11 18:46:42 +0000
commit1c1cea8baec472eb39ae92d92e2b9b1321334f9c (patch)
treeec6e360f30971e2dcb08e73ebde9a8e1c94f1e4d /test/sqldiff1.test
parent828cdb3473fadfcd8b78251e747ab3b9df1eda4a (diff)
parentd13b2319234ddb4857b7b793ec3b26b76251a6ca (diff)
downloadsqlite-1c1cea8baec472eb39ae92d92e2b9b1321334f9c.tar.gz
sqlite-1c1cea8baec472eb39ae92d92e2b9b1321334f9c.zip
Merge latest trunk changes into this branch.
FossilOrigin-Name: 82e5a6e088c58815140ad36715ac11c96527cb25
Diffstat (limited to 'test/sqldiff1.test')
-rw-r--r--test/sqldiff1.test57
1 files changed, 57 insertions, 0 deletions
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;}