2015-12-11 12:26:16 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2015-12-17 10:54:08 +00:00
|
|
|
// Flags: --expose-wasm
|
|
|
|
|
2016-03-07 19:32:35 +00:00
|
|
|
load("test/mjsunit/wasm/wasm-module-builder.js");
|
2015-12-11 12:26:16 +00:00
|
|
|
|
2016-03-07 19:32:35 +00:00
|
|
|
var main = (function () {
|
|
|
|
var builder = new WasmModuleBuilder();
|
2016-04-29 09:39:26 +00:00
|
|
|
builder.addFunction("main", kSig_v_v)
|
2016-03-07 19:32:35 +00:00
|
|
|
.addBody([kExprUnreachable])
|
|
|
|
.exportAs("main");
|
2015-12-11 12:26:16 +00:00
|
|
|
|
2016-03-07 19:32:35 +00:00
|
|
|
return builder.instantiate().exports.main;
|
2015-12-11 12:26:16 +00:00
|
|
|
})();
|
|
|
|
|
|
|
|
var exception = "";
|
|
|
|
try {
|
2016-03-07 19:32:35 +00:00
|
|
|
assertEquals(0, main());
|
2015-12-11 12:26:16 +00:00
|
|
|
} catch(e) {
|
|
|
|
print("correctly caught: " + e);
|
|
|
|
exception = e;
|
|
|
|
}
|
2016-04-20 14:51:35 +00:00
|
|
|
assertEquals("unreachable", exception.message);
|