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

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

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 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/shell6.test ('k') | third_party/sqlite/src/test/skipscan1.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/shell7.test
diff --git a/third_party/sqlite/src/test/shell7.test b/third_party/sqlite/src/test/shell7.test
new file mode 100644
index 0000000000000000000000000000000000000000..a06288514029bd2d8fed51312aa9885f68a2da72
--- /dev/null
+++ b/third_party/sqlite/src/test/shell7.test
@@ -0,0 +1,54 @@
+# 2016 December 17
+#
+# 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.
+#
+#***********************************************************************
+#
+# Test the readfile() function built into the shell tool. Specifically,
+# that it does not truncate the blob read at the first embedded 0x00
+# byte.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix shell7
+set CLI [test_find_cli]
+
+
+do_execsql_test 1.0 {
+ CREATE TABLE f1(tn INTEGER PRIMARY KEY, x BLOB);
+ CREATE TABLE f2(tn INTEGER PRIMARY KEY, x BLOB);
+
+ INSERT INTO f1 VALUES(1, X'01020304');
+ INSERT INTO f1 VALUES(2, X'01000304');
+ INSERT INTO f1 VALUES(3, randomblob(200));
+}
+
+foreach {tn l x} [db eval { SELECT tn, length(x) AS l, x FROM f1 }] {
+ forcedelete shell7_test.bin
+ set fd [open shell7_test.bin w]
+ fconfigure $fd -encoding binary
+ fconfigure $fd -translation binary
+ puts -nonewline $fd $x
+ close $fd
+
+ do_test 1.$tn.1 { file size shell7_test.bin } $l
+ do_test 1.$tn.2 {
+ catchcmd test.db "INSERT INTO f2 VALUES($tn, readfile('shell7_test.bin'));"
+ } {0 {}}
+
+ do_execsql_test 1.$tn.3 {
+ SELECT (SELECT x FROM f1 WHERE tn=1)==(SELECT x FROM f2 WHERE tn=1)
+ } {1}
+}
+
+
+
+finish_test
+
+
« no previous file with comments | « third_party/sqlite/src/test/shell6.test ('k') | third_party/sqlite/src/test/skipscan1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698