diff options
Diffstat (limited to 'test/binaryen.js/expressions.js')
-rw-r--r-- | test/binaryen.js/expressions.js | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js index 757d88b1b..603ca3250 100644 --- a/test/binaryen.js/expressions.js +++ b/test/binaryen.js/expressions.js @@ -37,6 +37,7 @@ console.log("# Block"); assert(theBlock.type === binaryen.i32); assert(theBlock.numChildren === 0); assertDeepEqual(theBlock.children, []); + assertDeepEqual(theBlock.getChildren(), []); var child1 = module.i32.const(1); theBlock.appendChild(child1); @@ -205,11 +206,12 @@ console.log("# Switch"); assert(theSwitch.value === value); assert(theSwitch.type === binaryen.unreachable); - theSwitch.names = names = [ + names = [ "1", // set - "2", // set - "3" // append - ]; + "2", //set + "3" // append + ] + theSwitch.setNames(names); assertDeepEqual(theSwitch.names, names); theSwitch.names = names = [ "x", // set @@ -217,6 +219,7 @@ console.log("# Switch"); // remove ]; assertDeepEqual(theSwitch.names, names); + assertDeepEqual(theSwitch.getNames(), names); theSwitch.insertNameAt(1, "y"); theSwitch.condition = condition = module.i32.const(3); assert(theSwitch.condition === condition); @@ -248,6 +251,7 @@ console.log("# Call"); assert(theCall instanceof binaryen.Expression); assert(theCall.target === target); assertDeepEqual(theCall.operands, operands); + assertDeepEqual(theCall.getOperands(), operands); assert(theCall.return === false); assert(theCall.type === binaryen.i32); @@ -259,11 +263,12 @@ console.log("# Call"); module.i32.const(5) // append ]; assertDeepEqual(theCall.operands, operands); - theCall.operands = operands = [ + operands = [ module.i32.const(6) // set // remove // remove ]; + theCall.setOperands(operands); assertDeepEqual(theCall.operands, operands); theCall.insertOperandAt(0, module.i32.const(7)); theCall.return = true; @@ -315,12 +320,14 @@ console.log("# CallIndirect"); module.i32.const(5) // append ]; assertDeepEqual(theCallIndirect.operands, operands); - theCallIndirect.operands = operands = [ + operands = [ module.i32.const(6) // set // remove // remove ]; + theCallIndirect.setOperands(operands); assertDeepEqual(theCallIndirect.operands, operands); + assertDeepEqual(theCallIndirect.getOperands(), operands); theCallIndirect.insertOperandAt(0, module.i32.const(7)); theCallIndirect.return = true; assert(theCallIndirect.return === true); @@ -1525,11 +1532,13 @@ console.log("# Throw"); module.i32.const(5) // append ]; assertDeepEqual(theThrow.operands, operands); - theThrow.operands = operands = [ + assertDeepEqual(theThrow.getOperands(), operands); + operands = [ module.i32.const(6) // set // remove // remove ]; + theThrow.setOperands(operands); assertDeepEqual(theThrow.operands, operands); theThrow.insertOperandAt(1, module.i32.const(7)); theThrow.type = binaryen.f64; @@ -1630,12 +1639,14 @@ console.log("# TupleMake"); module.i32.const(5) // append ]; assertDeepEqual(theTupleMake.operands, operands); - theTupleMake.operands = operands = [ + operands = [ module.i32.const(6) // set // remove // remove ]; + theTupleMake.setOperands(operands); assertDeepEqual(theTupleMake.operands, operands); + assertDeepEqual(theTupleMake.getOperands(), operands); theTupleMake.insertOperandAt(1, module.i32.const(7)); theTupleMake.type = binaryen.f64; theTupleMake.finalize(); |