aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/tester1.c-pp.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-12-16 13:04:21 +0000
committerstephan <stephan@noemail.net>2022-12-16 13:04:21 +0000
commite9f740e48408fe5cb2eac650238b85cf8b002ff7 (patch)
tree8fa0e07852ff0e3d0b56aab498db719c1032d7f3 /ext/wasm/tester1.c-pp.js
parentd980442188dda47b965e0cd7c822536acdddc72d (diff)
downloadsqlite-e9f740e48408fe5cb2eac650238b85cf8b002ff7.tar.gz
sqlite-e9f740e48408fe5cb2eac650238b85cf8b002ff7.zip
Expose a JS-friendly subset of sqlite3_config() to JS, with the notable caveats that (1) setting up the JS bindings requires starting the library, making sqlite3_config() illegal to call and (2) calling sqlite3_shutdown() in order to make it legal to call sqlite3_config() may undo certain JS-side library initialization. Move sqlite3_(de)serialize() into the int64-mode-only bindings because of their int64 args.
FossilOrigin-Name: 62e0c931ac952219f68e22d64e20836781bf330b4581e4662266172a97c9289b
Diffstat (limited to 'ext/wasm/tester1.c-pp.js')
-rw-r--r--ext/wasm/tester1.c-pp.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js
index aaac35ad3..bef34a0ba 100644
--- a/ext/wasm/tester1.c-pp.js
+++ b/ext/wasm/tester1.c-pp.js
@@ -345,6 +345,38 @@ self.sqlite3InitModule = sqlite3InitModule;
////////////////////////////////////////////////////////////////////
T.g('Basic sanity checks')
.t({
+ name:'sqlite3_config()',
+ test:function(sqlite3){
+ for(const k of [
+ 'SQLITE_CONFIG_GETMALLOC', 'SQLITE_CONFIG_URI'
+ ]){
+ T.assert(capi[k] > 0);
+ }
+ T.assert(capi.SQLITE_MISUSE===capi.sqlite3_config(
+ capi.SQLITE_CONFIG_URI, 1
+ ), "MISUSE because the library has already been initialized.");
+ T.assert(capi.SQLITE_MISUSE === capi.sqlite3_config(
+ // not enough args
+ capi.SQLITE_CONFIG_GETMALLOC
+ ));
+ T.assert(capi.SQLITE_NOTFOUND === capi.sqlite3_config(
+ // unhandled-in-JS config option
+ capi.SQLITE_CONFIG_GETMALLOC, 1
+ ));
+ if(0){
+ log("We cannot _fully_ test sqlite3_config() after the library",
+ "has been initialized (which it necessarily has been to",
+ "set up various bindings) and we cannot shut it down ",
+ "without losing the VFS registrations.");
+ T.assert(0 === capi.sqlite3_config(
+ capi.SQLITE_CONFIG_URI, 1
+ ));
+ }
+ }
+ })/*sqlite3_config()*/
+
+ ////////////////////////////////////////////////////////////////////
+ .t({
name: "JS wasm-side allocator",
test: function(sqlite3){
if(sqlite3.config.useStdAlloc){
@@ -422,6 +454,7 @@ self.sqlite3InitModule = sqlite3InitModule;
assert(0===capi.sqlite3_strlike("%.txt", "foo.txt", 0)).
assert(0!==capi.sqlite3_strlike("%.txt", "foo.xtx", 0));
})
+
////////////////////////////////////////////////////////////////////
;/*end of basic sanity checks*/