blob: 096863591cbc20e10dad44f3dbb91f369b3339b7 [file] [log] [blame] [edit]
// Parse invalid text and get a JS exception.
var caughtAsExpected = false;
try {
console.log('parsing invalid text...');
binaryen.parseText(`(module
;; error on next line
(func $foo (param__error $x i32))
)`)
console.log('no error - invalid');
} catch (e) {
assert(e.message === '3:16: error: unrecognized instruction');
caughtAsExpected = true;
}
assert(caughtAsExpected);
console.log('success.');