]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a few more zipfile tests. No changes to code.
authordan <dan@noemail.net>
Thu, 1 Feb 2018 20:42:23 +0000 (20:42 +0000)
committerdan <dan@noemail.net>
Thu, 1 Feb 2018 20:42:23 +0000 (20:42 +0000)
FossilOrigin-Name: 3f621545879ea39502cfaf2b61883f92c077070274b4fdf45524ded81cac3e63

manifest
manifest.uuid
test/zipfile.test
test/zipfilefault.test

index e4aa3f1840017323039aed62b75d665ef882902e..868870f090c6ef54443fe38da4ea4d6d844a7f1c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\striggered\swhen\sa\szipfile\svirtual\stable\sis\screated\sand\swritten\sto\nwithin\sthe\ssame\stransaction.\sAnd\sadd\sother\szipfile\stest.
-D 2018-02-01T19:41:23.066
+C Add\sa\sfew\smore\szipfile\stests.\sNo\schanges\sto\scode.
+D 2018-02-01T20:42:23.543
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 7a3f714b4fcf793108042b7b0a5c720b0b310ec84314d61ba7f3f49f27e550ea
@@ -1603,9 +1603,9 @@ F test/wordcount.c cb589cec469a1d90add05b1f8cee75c7210338d87a5afd65260ed5c0f4bbf
 F test/writecrash.test f1da7f7adfe8d7f09ea79b42e5ca6dcc41102f27f8e334ad71539501ddd910cc
 F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
 F test/zerodamage.test 9c41628db7e8d9e8a0181e59ea5f189df311a9f6ce99cc376dc461f66db6f8dc
-F test/zipfile.test 1f066994bd77493c87e8ee4bd94db0651d180cff19ffbbe0b70085eb9a2cb34c
+F test/zipfile.test 44aa8af115cc3e8c905468768dc761260650a8fdfca57e10f9818f5f8008d340
 F test/zipfile2.test 67d5f08a202796d4b7a71dfa4b8dcb74aa7a9d1f42c5f17bedff9855c1ba7aa5
-F test/zipfilefault.test 73b08e3d0bbeb275e325ee7e3678ca98781de0737f9153ca23bde1f48a93d728
+F test/zipfilefault.test 050be76778d2ec83566a542800fc3967f65ce719671a819016ada8b654bc14f7
 F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
 F tool/GetTclKit.bat 8995df40c4209808b31f24de0b58f90930239a234f7591e3675d45bfbb990c5d
 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
@@ -1704,7 +1704,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 5a70af1e9c567f12c997d25d0a305a8d42bf2cc92f2811e9d5fdde720665e213
-R ec6ac070bff5134b5a74e8c3afc721f5
+P 48f1c556994d7f8f359c649a1da81eec02306106b68946a9a20b276742c4610d
+R cdbed97cc578ccd9e756b9f206f65092
 U dan
-Z 34f839c0a19e1ff6432f6acef976c132
+Z 07c3c59583bca5bfb67bba61fc8753c1
index be5881914dc2df567e7a37a16e95b5a9bc00cfac..3a4e6a6861c97e2fc7257aea44659b47395c6ccb 100644 (file)
@@ -1 +1 @@
-48f1c556994d7f8f359c649a1da81eec02306106b68946a9a20b276742c4610d
\ No newline at end of file
+3f621545879ea39502cfaf2b61883f92c077070274b4fdf45524ded81cac3e63
\ No newline at end of file
index b31077d33c5f069939576b08a641f8b88c4a2755..2bb3f0789208fbf229ca2a8c9d4f972f10474549 100644 (file)
@@ -440,6 +440,37 @@ foreach {tn mode} {
   } [list 1 "zipfile: parse error in mode: $mode"]
 }
 
+do_catchsql_test 4.6 {
+  WITH c(name,data) AS ( SELECT 'a.txt', 'abc')
+  SELECT zipfile(name) FROM c
+} {1 {wrong number of arguments to function zipfile()}}
+
+do_catchsql_test 4.7 {
+  WITH c(name,data) AS ( 
+    SELECT 'a.txt', 'abc' UNION ALL
+    SELECT NULL, 'def'
+  )
+  SELECT zipfile(name,data) FROM c
+} {1 {first argument to zipfile() must be non-NULL}}
+
+do_catchsql_test 4.7 {
+  WITH c(name,data,method) AS ( 
+    SELECT 'a.txt', 'abc', 0
+    UNION SELECT 'b.txt', 'def', 8
+    UNION SELECT 'c.txt', 'ghi', 16
+  )
+  SELECT zipfile(name,NULL,NULL,data,method) FROM c
+} {1 {illegal method value: 16}}
+
+do_catchsql_test 4.8 {
+  WITH c(name,data) AS ( 
+    SELECT 'a.txt', 'abc'
+    UNION SELECT 'b.txt', 'def'
+    UNION SELECT 'c.txt/', 'ghi'
+  )
+  SELECT zipfile(name,NULL,NULL,data) FROM c
+} {1 {non-directory name must not end with /}}
+
 #--------------------------------------------------------------------------
 
 db func rt remove_timestamps
@@ -448,7 +479,7 @@ do_execsql_test 5.0 {
     SELECT 'a.txt', 946684800, 'abc'
   )
   SELECT name,mtime,data FROM zipfile(
-    ( SELECT rt( zipfile(name,NULL,mtime,data) ) FROM c )
+    ( SELECT rt( zipfile(name,NULL,mtime,data,NULL) ) FROM c )
   )
 } {
   a.txt 946684800 abc
@@ -592,5 +623,18 @@ do_execsql_test 8.3.1 {
   COMMIT;
 }
 
+#-------------------------------------------------------------------------
+# Test that the zipfile aggregate correctly adds and removes "/" from
+# the ends of directory file names.
+do_execsql_test 9.0 {
+  WITH src(nm) AS (
+    VALUES('dir1') UNION ALL
+    VALUES('dir2/') UNION ALL
+    VALUES('dir3//') UNION ALL
+    VALUES('dir4///') UNION ALL
+    VALUES('/') 
+  )
+  SELECT name FROM zipfile((SELECT zipfile(nm, NULL) FROM src))
+} {dir1/ dir2/ dir3/ dir4/ /}
 finish_test
 
index a850b5146a1b395bb1f11feff735b4730fbc8769..158370695e43aa8b0102720f4e193d768ff8a678 100644 (file)
@@ -84,6 +84,7 @@ do_faultsim_test 4 -faults oom* -body {
 }
 
 reset_db
+sqlite3_db_config_lookaside db 0 0 0
 load_static_extension db zipfile
 
 do_execsql_test 5.0 {
@@ -127,6 +128,38 @@ do_faultsim_test 5.3 -faults oom* -prep {
   faultsim_test_result {0 {}}
 }
 
+do_faultsim_test 6.1 -faults oom* -body {
+  execsql {
+    WITH c(n, d) AS (
+      VALUES('a.txt', '1234567890') UNION ALL
+      VALUES('dir', NULL)
+    )
+    SELECT zipfile(n, d) IS NULL FROM c;
+  }
+} -test {
+  faultsim_test_result {0 0}
+}
+
+set big [string repeat 0123456789 1000]
+do_faultsim_test 6.2 -faults oom* -body {
+  execsql {
+    WITH c(n, d) AS (
+      VALUES('a.txt', $big)
+    )
+    SELECT zipfile(n, NULL, NULL, d, 0) IS NULL FROM c;
+  }
+} -test {
+  faultsim_test_result {0 0}
+}
+
+do_faultsim_test 7.0 -faults oom* -prep {
+  catch { db close }
+  sqlite3 db ""
+} -body {
+  load_static_extension db zipfile
+} -test {
+}
+
 
 finish_test