aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/tester1.c-pp.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-07-26 11:11:39 +0000
committerstephan <stephan@noemail.net>2023-07-26 11:11:39 +0000
commitaef4fbf2032894a8b3096953b9aed54763b12e7f (patch)
tree153a1b6465c624129b31530402f186888358c827 /ext/wasm/tester1.c-pp.js
parent3ba691412109e192b5e052e5006337f9ba907fbe (diff)
downloadsqlite-aef4fbf2032894a8b3096953b9aed54763b12e7f.tar.gz
sqlite-aef4fbf2032894a8b3096953b9aed54763b12e7f.zip
Add SAHPoolUtil.getFileNames() method, and tests for it, per [forum:a3da1e34d8|forum feedback]. Add a test to demonstrate that two SAH pools can coexist so long as they have different names.
FossilOrigin-Name: 72dc3f8c3255186ec412412b685b0b51ddcd08240f2353ac742fc7da8c23568e
Diffstat (limited to 'ext/wasm/tester1.c-pp.js')
-rw-r--r--ext/wasm/tester1.c-pp.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js
index 905340b23..db4b50f4b 100644
--- a/ext/wasm/tester1.c-pp.js
+++ b/ext/wasm/tester1.c-pp.js
@@ -3072,10 +3072,23 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
db = new u2.OpfsSAHPoolDb(dbName);
T.assert(1 === u1.getFileCount());
db.close();
- T.assert(1 === u1.getFileCount())
+ const fileNames = u1.getFileNames();
+ T.assert(1 === fileNames.length)
+ .assert(dbName === fileNames[0])
+ .assert(1 === u1.getFileCount())
.assert(true === u1.unlink(dbName))
.assert(false === u1.unlink(dbName))
- .assert(0 === u1.getFileCount());
+ .assert(0 === u1.getFileCount())
+ .assert(0 === u1.getFileNames().length);
+
+ // Demonstrate that two SAH pools can coexist so long as
+ // they have different names.
+ const conf2 = JSON.parse(JSON.stringify(sahPoolConfig));
+ conf2.name += '-test2';
+ const POther = await inst(conf2);
+ log("Installed second SAH instance as",conf2.name);
+ T.assert(0 === POther.getFileCount())
+ .assert(true === await POther.removeVfs());
if(0){
/* Enable this block to inspect vfs's contents via the dev
console or OPFS Explorer browser extension. The
@@ -3087,7 +3100,6 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
.assert(!sqlite3.capi.sqlite3_vfs_find(sahPoolConfig.name));
let cErr, u3;
- const conf2 = JSON.parse(JSON.stringify(sahPoolConfig));
conf2.$testThrowInInit = new Error("Testing throwing during init.");
conf2.name = sahPoolConfig.name+'-err';
const P3 = await inst(conf2).then(u=>u3 = u).catch((e)=>cErr=e);