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

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

Issue 2108193003: [modules] AST and parser rework. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@anonymous-declarations
Patch Set: Rebase. Created 4 years, 5 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/interpreter/bytecode_expectations/Generators.golden ('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 02fc6d47a40025bdfce413f78b47a50af8fca010..11c894093bbe77b30d059a680af11a7d6699d4e2 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -5890,6 +5890,11 @@ TEST(ModuleParsingInternals) {
"import n from 'n.js';"
"export { a as b } from 'm.js';"
"export * from 'p.js';"
+ "export var foo;"
+ "export function goo() {};"
+ "export let hoo;"
+ "export const joo = 42;"
+ "export default (function koo() {});"
"import 'q.js'";
i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource);
i::Handle<i::Script> script = factory->NewScript(source);
@@ -5907,34 +5912,18 @@ TEST(ModuleParsingInternals) {
CHECK(module_scope->is_module_scope());
i::ModuleDescriptor* descriptor = module_scope->module();
CHECK_NOT_NULL(descriptor);
- CHECK_EQ(1, descriptor->Length());
- const i::AstRawString* export_name =
- info.ast_value_factory()->GetOneByteString("y");
- const i::AstRawString* local_name =
- descriptor->LookupLocalExport(export_name, &zone);
- CHECK_NOT_NULL(local_name);
- CHECK(local_name->IsOneByteEqualTo("x"));
i::ZoneList<i::Declaration*>* declarations = module_scope->declarations();
- CHECK_EQ(3, declarations->length());
+ CHECK_EQ(8, 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"));
- // TODO(adamk): Add test for indirect exports once they're fully implemented.
- // TODO(adamk): Add test for star exports once they're fully implemented.
- const i::ZoneList<const i::AstRawString*>& requested_modules =
- descriptor->requested_modules();
- CHECK_EQ(4, requested_modules.length());
- CHECK(requested_modules[0]->IsOneByteEqualTo("m.js"));
- CHECK(requested_modules[1]->IsOneByteEqualTo("n.js"));
- CHECK(requested_modules[2]->IsOneByteEqualTo("p.js"));
- CHECK(requested_modules[3]->IsOneByteEqualTo("q.js"));
+ CHECK(declarations->at(1)->proxy()->raw_name()->IsOneByteEqualTo("z"));
+ CHECK(declarations->at(2)->proxy()->raw_name()->IsOneByteEqualTo("n"));
+ CHECK(declarations->at(3)->proxy()->raw_name()->IsOneByteEqualTo("foo"));
+ CHECK(declarations->at(4)->proxy()->raw_name()->IsOneByteEqualTo("goo"));
+ CHECK(declarations->at(5)->proxy()->raw_name()->IsOneByteEqualTo("hoo"));
+ CHECK(declarations->at(6)->proxy()->raw_name()->IsOneByteEqualTo("joo"));
+ CHECK(
+ declarations->at(7)->proxy()->raw_name()->IsOneByteEqualTo("*default*"));
+ // TODO(neis): Test more once we can inspect the imports/exports.
}
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Generators.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698