diff options
author | stephan <stephan@noemail.net> | 2022-12-24 13:46:27 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-12-24 13:46:27 +0000 |
commit | 0db1c901378e29fd576e93d16a1305c6269d411d (patch) | |
tree | bf40c460f31c7832371f005a14b5168022279f1d /ext/wasm/tester1.c-pp.js | |
parent | 4b4ae86445c621a3eb6b67b96c67a3eb29d9751a (diff) | |
download | sqlite-0db1c901378e29fd576e93d16a1305c6269d411d.tar.gz sqlite-0db1c901378e29fd576e93d16a1305c6269d411d.zip |
Add a test for the (failure) case of client-level code calling the oo1.Stmt constructor directly.
FossilOrigin-Name: 6a37874db04f3b4842994ad17fc74cb6222f8ea0fa1315a23aff1ffa69bcd12a
Diffstat (limited to 'ext/wasm/tester1.c-pp.js')
-rw-r--r-- | ext/wasm/tester1.c-pp.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/wasm/tester1.c-pp.js b/ext/wasm/tester1.c-pp.js index 82dd73e23..8b80d4d88 100644 --- a/ext/wasm/tester1.c-pp.js +++ b/ext/wasm/tester1.c-pp.js @@ -1219,7 +1219,7 @@ self.sqlite3InitModule = sqlite3InitModule; }) //////////////////////////////////////////////////////////////////// - .t('DB.Stmt', function(S){ + .t('DB.Stmt', function(sqlite3){ let st = this.db.prepare( new TextEncoder('utf-8').encode("select 3 as a") ); @@ -1274,6 +1274,12 @@ self.sqlite3InitModule = sqlite3InitModule; } T.assert(!st.pointer) .assert(0===this.db.openStatementCount()); + + T.mustThrowMatching(()=>new sqlite3.oo1.Stmt("hi"), function(err){ + return (err instanceof sqlite3.SQLite3Error) + && capi.SQLITE_MISUSE === err.resultCode + && 0 < err.message.indexOf("Do not call the Stmt constructor directly.") + }); }) //////////////////////////////////////////////////////////////////////// |