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

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

Issue 958213006: Create ImportDeclarations for default imports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 02f8869c419fc4c70504c2ac87fa1cf8fe3e7ee3..7318448497b9ea28598205ff40e5cbc591de9d10 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5219,7 +5219,10 @@ TEST(ModuleParsingInternals) {
128 * 1024);
static const char kSource[] =
- "let x = 5; export { x as y }; import { q as z } from 'm.js';";
+ "let x = 5;"
+ "export { x as y };"
+ "import { q as z } from 'm.js';"
+ "import n from 'n.js'";
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source);
i::CompilationInfoWithZone info(script);
@@ -5241,13 +5244,17 @@ TEST(ModuleParsingInternals) {
}
CHECK_EQ(1, num_exports);
i::ZoneList<i::Declaration*>* declarations = func->scope()->declarations();
- CHECK_EQ(2, declarations->length());
+ CHECK_EQ(3, declarations->length());
CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x"));
i::ImportDeclaration* import_decl =
declarations->at(1)->AsImportDeclaration();
CHECK(import_decl->import_name()->IsOneByteEqualTo("q"));
CHECK(import_decl->proxy()->raw_name()->IsOneByteEqualTo("z"));
CHECK(import_decl->module_specifier()->IsOneByteEqualTo("m.js"));
+ import_decl = declarations->at(2)->AsImportDeclaration();
+ CHECK(import_decl->import_name()->IsOneByteEqualTo("default"));
+ CHECK(import_decl->proxy()->raw_name()->IsOneByteEqualTo("n"));
+ CHECK(import_decl->module_specifier()->IsOneByteEqualTo("n.js"));
}
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698