mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 01:41:30 +00:00
support normal arrays
This commit is contained in:
@ -72,6 +72,17 @@ assert.strictEqual(module.__getString(module.COLOR), "red");
|
||||
try { module.__release(ref); assert(false); } catch (e) {};
|
||||
}
|
||||
|
||||
// should be able to work with normal arrays
|
||||
{
|
||||
let arr = [1, 2, 3, 4, 5];
|
||||
let ref = module.__retain(module.__allocArray(module.ARRAYI32_ID, arr));
|
||||
assert(module.__instanceof(ref, module.ARRAYI32_ID));
|
||||
module.changeLength(ref, 3);
|
||||
assert.deepEqual(module.__getArray(ref), [1, 2, 3]);
|
||||
module.__release(ref);
|
||||
try { module.__release(ref); assert(false); } catch (e) {};
|
||||
}
|
||||
|
||||
// should be able to correctly call a function with variable arguments
|
||||
assert.strictEqual(module.varadd(), 3);
|
||||
assert.strictEqual(module.varadd(2, 3), 5);
|
||||
|
Reference in New Issue
Block a user