Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: third_party/sqlite/src/test/rollback2.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/rollback.test ('k') | third_party/sqlite/src/test/rowid.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/rollback2.test
diff --git a/third_party/sqlite/src/test/rollback2.test b/third_party/sqlite/src/test/rollback2.test
new file mode 100644
index 0000000000000000000000000000000000000000..9637f0c0e592fb88fc97b3a7032deebe60f51a24
--- /dev/null
+++ b/third_party/sqlite/src/test/rollback2.test
@@ -0,0 +1,74 @@
+# 2014 November 12
+#
+# 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.
+#
+#***********************************************************************
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set ::testprefix rollback2
+
+proc int2hex {i} { format %.2X $i }
+db func int2hex int2hex
+
+do_execsql_test 1.0 {
+ SELECT int2hex(0), int2hex(100), int2hex(255)
+} {00 64 FF}
+do_execsql_test 1.1 {
+ CREATE TABLE t1(i, h);
+ CREATE INDEX i1 ON t1(h);
+ WITH data(a, b) AS (
+ SELECT 1, int2hex(1)
+ UNION ALL
+ SELECT a+1, int2hex(a+1) FROM data WHERE a<40
+ )
+ INSERT INTO t1 SELECT * FROM data;
+} {}
+
+
+proc do_rollback_test {tn args} {
+ set A(-setup) ""
+ set A(-select) ""
+ set A(-result) ""
+ set A(-rollback) ROLLBACK
+
+ array set O $args
+ foreach k [array names O] {
+ if {[info exists A($k)]==0} { error "unknown option: $k" }
+ set A($k) $O($k)
+ }
+
+ for {set iRollback 0} 1 {incr iRollback} {
+ catch { db eval ROLLBACK }
+ set res [list]
+ db eval $A(-setup)
+
+ set i 0
+ db eval $A(-select) x {
+ if {$i==$iRollback} { db eval $A(-rollback) }
+ foreach k $x(*) { lappend res $x($k) }
+ incr i
+ }
+
+ do_test $tn.$iRollback [list set {} $res] [list {*}$A(-result)]
+ if {$i < $iRollback} break
+ }
+}
+
+do_rollback_test 2 -setup {
+ BEGIN;
+ DELETE FROM t1 WHERE (i%2)==1;
+} -select {
+ SELECT i FROM t1 WHERE (i%2)==0
+} -result {
+ 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40
+}
+
+finish_test
+
« no previous file with comments | « third_party/sqlite/src/test/rollback.test ('k') | third_party/sqlite/src/test/rowid.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698