OLD | NEW |
(Empty) | |
| 1 // 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 #include "test/cctest/cctest.h" |
| 6 |
| 7 TEST(ModuleCompilation) { |
| 8 v8::internal::FLAG_harmony_modules = true; |
| 9 v8::Isolate* isolate = CcTest::isolate(); |
| 10 v8::HandleScope handle_scope(isolate); |
| 11 LocalContext context; |
| 12 |
| 13 CompileRun( |
| 14 "var data = [];" |
| 15 "function store(thing) {" |
| 16 " data.push(thing);" |
| 17 "}"); |
| 18 |
| 19 CompileRunModule( |
| 20 "export let a = 42;" |
| 21 "store(a)"); |
| 22 |
| 23 CHECK_EQ(1, CompileRun("data.length")->Int32Value()); |
| 24 CHECK_EQ(42, CompileRun("data[0]")->Int32Value()); |
| 25 } |
OLD | NEW |