blob: fe6fc14e05e2f2eca27a0cb2fb30ed941d6ae79f [file] [log] [blame]
Ben Murdochf2e39942016-05-18 10:25:55 +00001// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --expose-wasm
6
7load("test/mjsunit/wasm/wasm-constants.js");
Ben Murdoch3b9bc312016-06-02 14:46:10 +01008load("test/mjsunit/wasm/wasm-module-builder.js");
Ben Murdochf2e39942016-05-18 10:25:55 +00009
Ben Murdoch3b9bc312016-06-02 14:46:10 +010010(function BasicTest() {
11 var kReturnValue = 107;
12 var builder = new WasmModuleBuilder();
Ben Murdochf2e39942016-05-18 10:25:55 +000013
Ben Murdochbcf72ee2016-08-08 18:44:38 +010014 builder.addFunction("main", kSig_i_i)
Ben Murdoch3b9bc312016-06-02 14:46:10 +010015 .addBody([kExprI8Const, kReturnValue])
16 .exportFunc();
Ben Murdochf2e39942016-05-18 10:25:55 +000017
Ben Murdoch3b9bc312016-06-02 14:46:10 +010018 var main = builder.instantiate().exports.main;
19 assertEquals(kReturnValue, main());
20})();