mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Rename 'static-string' argument adapter to 'string:static'. Replace JS unit tests which were lost via editing a generated copy of tester1.js instead of the original tester1.c-pp.js input file.
FossilOrigin-Name: 9d81d51d5a255b42f8416da850c992a9e4c8eebc940e0702a9262cfcaa6d7b2f
This commit is contained in:
@@ -660,6 +660,26 @@ self.sqlite3InitModule = sqlite3InitModule;
|
||||
T.assert(rc>0 && Number.isFinite(rc));
|
||||
rc = w.xCallWrapped('sqlite3_wasm_enum_json','utf8');
|
||||
T.assert('string'===typeof rc).assert(rc.length>300);
|
||||
|
||||
|
||||
{ // 'string:static' argAdapter() sanity checks...
|
||||
let argAd = w.xWrap.argAdapter('string:static');
|
||||
let p0 = argAd('foo'), p1 = argAd('bar');
|
||||
T.assert(w.isPtr(p0) && w.isPtr(p1))
|
||||
.assert(p0 !== p1)
|
||||
.assert(p0 === argAd('foo'))
|
||||
.assert(p1 === argAd('bar'));
|
||||
}
|
||||
|
||||
// 'flexible-string' argAdapter() sanity checks...
|
||||
w.scopedAllocCall(()=>{
|
||||
const argAd = w.xWrap.argAdapter('flexible-string');
|
||||
const cj = (v)=>w.cstringToJs(argAd(v));
|
||||
T.assert('Hi' === cj('Hi'))
|
||||
.assert('hi' === cj(['h','i']))
|
||||
.assert('HI' === cj(new Uint8Array([72, 73])));
|
||||
});
|
||||
|
||||
if(haveWasmCTests()){
|
||||
if(!sqlite3.config.useStdAlloc){
|
||||
fw = w.xWrap('sqlite3_wasm_test_str_hello', 'utf8:dealloc',['i32']);
|
||||
|
Reference in New Issue
Block a user