Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: test/cctest/test-modules.cc

Issue 902093002: Add basic compilation support for modules (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-modules.cc
diff --git a/test/cctest/test-modules.cc b/test/cctest/test-modules.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fe494bbd35d2a30803afb7b656cc3895c1a7fb0b
--- /dev/null
+++ b/test/cctest/test-modules.cc
@@ -0,0 +1,25 @@
+// 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.
+
+#include "test/cctest/cctest.h"
+
+TEST(ModuleCompilation) {
+ v8::internal::FLAG_harmony_modules = true;
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope handle_scope(isolate);
+ LocalContext context;
+
+ CompileRun(
+ "var data = [];"
+ "function store(thing) {"
+ " data.push(thing);"
+ "}");
+
+ CompileRunModule(
+ "export let a = 42;"
+ "store(a)");
+
+ CHECK_EQ(1, CompileRun("data.length")->Int32Value());
+ CHECK_EQ(42, CompileRun("data[0]")->Int32Value());
+}
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698