Commit 5c2c5ce1 authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[test] Remove module pragma in favor of .mjs

d8 treats files with the .mjs extension as modules instead of
classic scripts. Thus, the `// MODULE` pragma and its corresponding
logic in test runners can be removed in favor of explicitly adding
the extension.

Bug: v8:7950, v8:9395, v8:9406
Also-By: tmrts@chromium.org
Change-Id: Ic74328dc5c5f176bb4bdf6d74bdd4d3966279ba5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1675958
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Auto-Submit: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62421}
parent 3caa3cc3
// Copyright 2016 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.
// MODULE
// Flags: --no-always-opt --no-opt
// The first part of this file is copied over from debug-set-variable-value.js
......@@ -328,7 +326,7 @@ export let ham = 1;
// Imported variable. Setting is currently not supported.
import { salami as wurst } from "./debug-modules-set-variable-value.js";
import { salami as wurst } from "./debug-modules-set-variable-value.mjs";
{
let exception;
function listener(event, exec_state) {
......@@ -350,7 +348,7 @@ import { salami as wurst } from "./debug-modules-set-variable-value.js";
// Imported variable, nested access. Setting is currently not supported.
import { salami as wurstl } from "./debug-modules-set-variable-value.js";
import { salami as wurstl } from "./debug-modules-set-variable-value.mjs";
{
let exception;
function listener(event, exec_state) {
......
// Copyright 2016 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.
// MODULE
// Flags: --allow-natives-syntax --noanalyze-environment-liveness
// These tests are copied from mjsunit/debug-scopes.js and adapted for modules.
......
......@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// MODULE
var Debug = debug.Debug;
var test_name;
......@@ -152,8 +149,8 @@ let local_let = 1;
var local_var = 2;
export let exported_let = 3;
export var exported_var = 4;
import {exported_let as imported_let} from "modules-debug-scopes2.js";
import {exported_var as imported_var} from "modules-debug-scopes2.js";
import {exported_let as imported_let} from "modules-debug-scopes2.mjs";
import {exported_var as imported_var} from "modules-debug-scopes2.mjs";
BeginTest();
listener_delegate = function(exec_state) {
......
......@@ -9,7 +9,6 @@ from testrunner.local import testsuite
from testrunner.objects import testcase
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
class TestLoader(testsuite.JSTestLoader):
......@@ -51,9 +50,7 @@ class TestCase(testcase.D8TestCase):
files.append(os.path.join(self.suite.root, "test-api.js"))
files.extend([os.path.normpath(os.path.join(self.suite.root, '..', '..', f))
for f in files_list])
if MODULE_PATTERN.search(source):
files.append("--module")
files.append(os.path.join(self.suite.root, self.path + self._get_suffix()))
files.append(self._get_source_path())
return files
def _get_files_params(self):
......@@ -69,7 +66,13 @@ class TestCase(testcase.D8TestCase):
return ['--enable-inspector', '--allow-natives-syntax']
def _get_source_path(self):
return os.path.join(self.suite.root, self.path + self._get_suffix())
base_path = os.path.join(self.suite.root, self.path)
# Try .js first, and fall back to .mjs.
# TODO(v8:9406): clean this up by never separating the path from
# the extension in the first place.
if os.path.exists(base_path + self._get_suffix()):
return base_path + self._get_suffix()
return base_path + '.mjs'
def GetSuite(*args, **kwargs):
......
// Copyright 2019 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.
//
// MODULE
class X {
constructor() {
......
*%(basename)s:9: SyntaxError: Private field '#x' must be declared in an enclosing class
*%(basename)s:7: SyntaxError: Private field '#x' must be declared in an enclosing class
this.#x = 1;
^
SyntaxError: Private field '#x' must be declared in an enclosing class
\ No newline at end of file
// 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.
//
// MODULE
var a, b, c;
export { a as c };
......
# 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.
*%(basename)s:9: SyntaxError: Duplicate export of 'c'
*%(basename)s:7: SyntaxError: Duplicate export of 'c'
export { a, b as c, c, b };
^
SyntaxError: Duplicate export of 'c'
// 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.
//
// MODULE
export default function f() {};
export default 42;
......
# 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.
*%(basename)s:9: SyntaxError: Duplicate export of 'default'
*%(basename)s:7: SyntaxError: Duplicate export of 'default'
export default class C {};
^^^^^^^
SyntaxError: Duplicate export of 'default'
// 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.
//
// MODULE
var a, b, c;
export { a };
......
# 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.
*%(basename)s:10: SyntaxError: Duplicate export of 'b'
*%(basename)s:8: SyntaxError: Duplicate export of 'b'
export { b, c };
^
SyntaxError: Duplicate export of 'b'
// 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.
//
// MODULE
import { foo as eval } from "mod";
# 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.
*%(basename)s:7: SyntaxError: Unexpected eval or arguments in strict mode
*%(basename)s:5: SyntaxError: Unexpected eval or arguments in strict mode
import { foo as eval } from "mod";
^^^^
SyntaxError: Unexpected eval or arguments in strict mode
// 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.
//
// MODULE
let foo = 42;
import { bar as foo } from "mod";
# 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.
*%(basename)s:8: SyntaxError: Identifier 'foo' has already been declared
*%(basename)s:6: SyntaxError: Identifier 'foo' has already been declared
import { bar as foo } from "mod";
^^^
SyntaxError: Identifier 'foo' has already been declared
// 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.
//
// MODULE
import { foo as import } from "mod";
# 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.
*%(basename)s:7: SyntaxError: Unexpected reserved word
*%(basename)s:5: SyntaxError: Unexpected reserved word
import { foo as import } from "mod";
^^^^^^
SyntaxError: Unexpected reserved word
// Copyright 2019 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.
//
// MODULE
(import{blah})
# Copyright 2019 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.
*%(basename)s:7: SyntaxError: Unexpected token '{'
*%(basename)s:5: SyntaxError: Unexpected token '{'
(import{blah})
^
SyntaxError: Unexpected token '{'
// 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.
//
// MODULE
import { eval } from "mod";
# 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.
*%(basename)s:7: SyntaxError: Unexpected eval or arguments in strict mode
*%(basename)s:5: SyntaxError: Unexpected eval or arguments in strict mode
import { eval } from "mod";
^^^^
SyntaxError: Unexpected eval or arguments in strict mode
// 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.
//
// MODULE
let foo = 42;
import { foo } from "mod";
# 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.
*%(basename)s:8: SyntaxError: Identifier 'foo' has already been declared
*%(basename)s:6: SyntaxError: Identifier 'foo' has already been declared
import { foo } from "mod";
^^^
SyntaxError: Identifier 'foo' has already been declared
// 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.
//
// MODULE
import { import } from "mod";
# 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.
*%(basename)s:7: SyntaxError: Unexpected reserved word
*%(basename)s:5: SyntaxError: Unexpected reserved word
import { import } from "mod";
^^^^^^
SyntaxError: Unexpected reserved word
// Copyright 2016 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.
//
// MODULE
import {a} from "modules-cycle1.js";
import {a} from "modules-cycle1.mjs";
export {a};
*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-cycle1.js'
import {a} from "modules-cycle1.js";
*%(basename)s:5: SyntaxError: Detected cycle while resolving name 'a' in 'modules-cycle1.mjs'
import {a} from "modules-cycle1.mjs";
^
SyntaxError: Detected cycle while resolving name 'a' in 'modules-cycle1.js'
SyntaxError: Detected cycle while resolving name 'a' in 'modules-cycle1.mjs'
// Copyright 2016 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.
//
// MODULE
import {a} from "modules-skip-cycle2.js";
import {a} from "modules-skip-cycle2.mjs";
export {a as b};
*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle2.js'
import {a} from "modules-skip-cycle2.js";
*%(basename)s:5: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle2.mjs'
import {a} from "modules-skip-cycle2.mjs";
^
SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle2.js'
SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle2.mjs'
// Copyright 2016 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.
export {a as x} from "modules-skip-cycle3.mjs";
export {b as y} from "modules-skip-cycle3.mjs";
*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js'
export {a as x} from "modules-skip-cycle3.js";
*%(basename)s:5: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.mjs'
export {a as x} from "modules-skip-cycle3.mjs";
^^^^^^
SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js'
SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.mjs'
// Copyright 2016 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.
import {x} from "modules-cycle3.mjs";
*modules-cycle3.js:7: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js'
export {a as x} from "modules-skip-cycle3.js";
*modules-cycle3.mjs:5: SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.mjs'
export {a as x} from "modules-skip-cycle3.mjs";
^^^^^^
SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.js'
SyntaxError: Detected cycle while resolving name 'a' in 'modules-skip-cycle3.mjs'
// Copyright 2017 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.
import "modules-skip-cycle5.mjs";
export {foo} from "modules-cycle5.mjs";
*%(basename)s:8: SyntaxError: Detected cycle while resolving name 'foo' in 'modules-cycle5.js'
export {foo} from "modules-cycle5.js";
*%(basename)s:6: SyntaxError: Detected cycle while resolving name 'foo' in 'modules-cycle5.mjs'
export {foo} from "modules-cycle5.mjs";
^^^
SyntaxError: Detected cycle while resolving name 'foo' in 'modules-cycle5.js'
SyntaxError: Detected cycle while resolving name 'foo' in 'modules-cycle5.mjs'
// Copyright 2017 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.
//
// MODULE
import "modules-skip-cycle6.js";
export * from "modules-cycle6.js";
// Copyright 2017 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.
import "modules-skip-cycle6.mjs";
export * from "modules-cycle6.mjs";
*modules-skip-cycle6.js:5: SyntaxError: The requested module 'modules-cycle6.js' does not provide an export named 'foo'
export {foo} from "modules-cycle6.js";
*modules-skip-cycle6.mjs:5: SyntaxError: The requested module 'modules-cycle6.mjs' does not provide an export named 'foo'
export {foo} from "modules-cycle6.mjs";
^^^
SyntaxError: The requested module 'modules-cycle6.js' does not provide an export named 'foo'
SyntaxError: The requested module 'modules-cycle6.mjs' does not provide an export named 'foo'
// Copyright 2016 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.
//
// MODULE
export let x = 42;
export {x};
export let x = 42;
*%(basename)s:8: SyntaxError: Duplicate export of 'x'
*%(basename)s:6: SyntaxError: Duplicate export of 'x'
export let x = 42;
^^^^^^^^^^^
SyntaxError: Duplicate export of 'x'
......
// Copyright 2016 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.
//
// MODULE
export {x};
export let x = 42;
export {x};
*%(basename)s:8: SyntaxError: Duplicate export of 'x'
*%(basename)s:6: SyntaxError: Duplicate export of 'x'
export {x};
^
SyntaxError: Duplicate export of 'x'
......
// Copyright 2016 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.
//
// MODULE
export let x = 42;
let y;
......
*%(basename)s:9: SyntaxError: Duplicate export of 'x'
*%(basename)s:7: SyntaxError: Duplicate export of 'x'
export {y as x};
^^^^^^
SyntaxError: Duplicate export of 'x'
......
// Copyright 2016 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.
//
// MODULE
export let x = 42;
let y;
......
*%(basename)s:9: SyntaxError: Duplicate export of 'x'
*%(basename)s:7: SyntaxError: Duplicate export of 'x'
export {y as z, y as x, y};
^^^^^^
SyntaxError: Duplicate export of 'x'
......
// Copyright 2018 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.
//
// MODULE
// Flags: --harmony-namespace-exports
export let foo = 42;
export * as foo from "./doesnt-even-matter.js";
export * as foo from "./doesnt-even-matter.mjs";
*%(basename)s:9: SyntaxError: Duplicate export of 'foo'
export * as foo from "./doesnt-even-matter.js";
*%(basename)s:8: SyntaxError: Duplicate export of 'foo'
export * as foo from "./doesnt-even-matter.mjs";
^^^
SyntaxError: Duplicate export of 'foo'
......@@ -2,6 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// MODULE
export class foo {[]};
*%(basename)s:7: SyntaxError: Unexpected token ']'
*%(basename)s:5: SyntaxError: Unexpected token ']'
export class foo {[]};
^
SyntaxError: Unexpected token ']'
......
// Copyright 2016 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.
//
// MODULE
export let x = 42;
import {x} from "modules-import-redeclare1.js";
// Copyright 2016 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.
export let x = 42;
import {x} from "modules-import-redeclare1.mjs";
*%(basename)s:8: SyntaxError: Identifier 'x' has already been declared
import {x} from "modules-import-redeclare1.js";
*%(basename)s:6: SyntaxError: Identifier 'x' has already been declared
import {x} from "modules-import-redeclare1.mjs";
^
SyntaxError: Identifier 'x' has already been declared
// Copyright 2016 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.
//
// MODULE
export let x = 42;
import {y, x, z} from "modules-import-redeclare1.js";
// Copyright 2016 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.
export let x = 42;
import {y, x, z} from "modules-import-redeclare1.mjs";
*%(basename)s:8: SyntaxError: Identifier 'x' has already been declared
import {y, x, z} from "modules-import-redeclare1.js";
*%(basename)s:6: SyntaxError: Identifier 'x' has already been declared
import {y, x, z} from "modules-import-redeclare1.mjs";
^
SyntaxError: Identifier 'x' has already been declared
// Copyright 2016 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.
//
// MODULE
import {y, x, z} from "modules-import-redeclare1.js";
export let x = 42;
// Copyright 2016 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.
import {y, x, z} from "modules-import-redeclare1.mjs";
export let x = 42;
*%(basename)s:8: SyntaxError: Identifier 'x' has already been declared
*%(basename)s:6: SyntaxError: Identifier 'x' has already been declared
export let x = 42;
^
SyntaxError: Identifier 'x' has already been declared
......
// Copyright 2016 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.
import {a} from "modules-import1.mjs";
*%(basename)s:7: SyntaxError: The requested module 'modules-import1.js' does not provide an export named 'a'
import {a} from "modules-import1.js";
*%(basename)s:5: SyntaxError: The requested module 'modules-import1.mjs' does not provide an export named 'a'
import {a} from "modules-import1.mjs";
^
SyntaxError: The requested module 'modules-import1.js' does not provide an export named 'a'
SyntaxError: The requested module 'modules-import1.mjs' does not provide an export named 'a'
// Copyright 2016 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.
//
// MODULE
import {a as b} from "modules-import2.js";
// Copyright 2016 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.
import {a as b} from "modules-import2.mjs";
*%(basename)s:7: SyntaxError: The requested module 'modules-import2.js' does not provide an export named 'a'
import {a as b} from "modules-import2.js";
*%(basename)s:5: SyntaxError: The requested module 'modules-import2.mjs' does not provide an export named 'a'
import {a as b} from "modules-import2.mjs";
^
SyntaxError: The requested module 'modules-import2.js' does not provide an export named 'a'
SyntaxError: The requested module 'modules-import2.mjs' does not provide an export named 'a'
// Copyright 2016 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.
//
// MODULE
import foo from "modules-import3.js";
// Copyright 2016 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.
import foo from "modules-import3.mjs";
*%(basename)s:7: SyntaxError: The requested module 'modules-import3.js' does not provide an export named 'default'
import foo from "modules-import3.js";
*%(basename)s:5: SyntaxError: The requested module 'modules-import3.mjs' does not provide an export named 'default'
import foo from "modules-import3.mjs";
^^^
SyntaxError: The requested module 'modules-import3.js' does not provide an export named 'default'
SyntaxError: The requested module 'modules-import3.mjs' does not provide an export named 'default'
// Copyright 2016 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.
//
// MODULE
import {a as b} from "modules-import4.js";
export {c as a} from "modules-import4.js";
// Copyright 2016 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.
import {a as b} from "modules-import4.mjs";
export {c as a} from "modules-import4.mjs";
*%(basename)s:8: SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c'
export {c as a} from "modules-import4.js";
*%(basename)s:6: SyntaxError: The requested module 'modules-import4.mjs' does not provide an export named 'c'
export {c as a} from "modules-import4.mjs";
^^^^^^
SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c'
SyntaxError: The requested module 'modules-import4.mjs' does not provide an export named 'c'
// Copyright 2016 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.
//
// MODULE
import {a as b} from "modules-import5.js";
export {c as a} from "modules-import5.js";
import {c} from "modules-import5.js";
// Copyright 2016 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.
//
// MODULE
export {a as x} from "modules-skip-cycle3.js";
export {b as y} from "modules-skip-cycle3.js";
import {a as b} from "modules-import5.mjs";
export {c as a} from "modules-import5.mjs";
import {c} from "modules-import5.mjs";
*%(basename)s:8: SyntaxError: The requested module 'modules-import5.js' does not provide an export named 'c'
export {c as a} from "modules-import5.js";
*%(basename)s:6: SyntaxError: The requested module 'modules-import5.mjs' does not provide an export named 'c'
export {c as a} from "modules-import5.mjs";
^^^^^^
SyntaxError: The requested module 'modules-import5.js' does not provide an export named 'c'
SyntaxError: The requested module 'modules-import5.mjs' does not provide an export named 'c'
// Copyright 2016 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.
//
// MODULE
import {a as b} from "modules-import6.js";
import {a as b} from "modules-import6.mjs";
export {c as a};
import {c} from "modules-import6.js";
import {c} from "modules-import6.mjs";
*%(basename)s:9: SyntaxError: The requested module 'modules-import6.js' does not provide an export named 'c'
import {c} from "modules-import6.js";
*%(basename)s:7: SyntaxError: The requested module 'modules-import6.mjs' does not provide an export named 'c'
import {c} from "modules-import6.mjs";
^
SyntaxError: The requested module 'modules-import6.js' does not provide an export named 'c'
SyntaxError: The requested module 'modules-import6.mjs' does not provide an export named 'c'
......@@ -2,4 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export {b as a} from "modules-cycle2.js";
export {b as a} from "modules-cycle2.mjs";
// Copyright 2016 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.
export {y as a} from "modules-cycle3.js";
export {x as b} from "modules-cycle3.js";
// Copyright 2016 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.
export {y as a} from "modules-cycle3.mjs";
export {x as b} from "modules-cycle3.mjs";
......@@ -2,4 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export {foo} from "modules-cycle5.js";
export {foo} from "modules-cycle5.mjs";
......@@ -2,4 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
export {foo} from "modules-cycle6.js";
export {foo} from "modules-cycle6.mjs";
// Copyright 2016 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.
//
// MODULE
import {a} from "../../mjsunit/modules-skip-7.js";
// Copyright 2016 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.
//
// MODULE
import {a} from "modules-import1.js";
import {a} from "../../mjsunit/modules-skip-7.mjs";
*%(basename)s:7: SyntaxError: The requested module '../../mjsunit/modules-skip-7.js' contains conflicting star exports for name 'a'
import {a} from "../../mjsunit/modules-skip-7.js";
*%(basename)s:5: SyntaxError: The requested module '../../mjsunit/modules-skip-7.mjs' contains conflicting star exports for name 'a'
import {a} from "../../mjsunit/modules-skip-7.mjs";
^
SyntaxError: The requested module '../../mjsunit/modules-skip-7.js' contains conflicting star exports for name 'a'
SyntaxError: The requested module '../../mjsunit/modules-skip-7.mjs' contains conflicting star exports for name 'a'
// Copyright 2016 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.
//
// MODULE
export * from "../../mjsunit/modules-skip-star-exports-conflict.js";
export * from "../../mjsunit/modules-skip-6.js";
export * from "../../mjsunit/modules-skip-star-exports-conflict.mjs";
export * from "../../mjsunit/modules-skip-6.mjs";
import {a} from "modules-star-conflict2.js";
import {a} from "modules-star-conflict2.mjs";
*%(basename)s:7: SyntaxError: The requested module '../../mjsunit/modules-skip-star-exports-conflict.js' contains conflicting star exports for name 'a'
export * from "../../mjsunit/modules-skip-star-exports-conflict.js";
*%(basename)s:5: SyntaxError: The requested module '../../mjsunit/modules-skip-star-exports-conflict.mjs' contains conflicting star exports for name 'a'
export * from "../../mjsunit/modules-skip-star-exports-conflict.mjs";
^
SyntaxError: The requested module '../../mjsunit/modules-skip-star-exports-conflict.js' contains conflicting star exports for name 'a'
SyntaxError: The requested module '../../mjsunit/modules-skip-star-exports-conflict.mjs' contains conflicting star exports for name 'a'
// Copyright 2016 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.
//
// MODULE
// Star exports do not propagate a default export.
import a from "modules-import4.js";
import a from "modules-import4.mjs";
*modules-import4.js:8: SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c'
export {c as a} from "modules-import4.js";
*modules-import4.mjs:6: SyntaxError: The requested module 'modules-import4.mjs' does not provide an export named 'c'
export {c as a} from "modules-import4.mjs";
^^^^^^
SyntaxError: The requested module 'modules-import4.js' does not provide an export named 'c'
SyntaxError: The requested module 'modules-import4.mjs' does not provide an export named 'c'
// Copyright 2016 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.
//
// MODULE
export {x};
*%(basename)s:7: SyntaxError: Export 'x' is not defined in module
*%(basename)s:5: SyntaxError: Export 'x' is not defined in module
export {x};
^
SyntaxError: Export 'x' is not defined in module
......
// Copyright 2016 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.
//
// MODULE
export {x as y};
*%(basename)s:7: SyntaxError: Export 'x' is not defined in module
*%(basename)s:5: SyntaxError: Export 'x' is not defined in module
export {x as y};
^^^^^^
SyntaxError: Export 'x' is not defined in module
......
......@@ -2,7 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// MODULE
function foo() {}
function foo() {}
*%(basename)s:8: SyntaxError: Identifier 'foo' has already been declared
*%(basename)s:6: SyntaxError: Identifier 'foo' has already been declared
function foo() {}
^
SyntaxError: Identifier 'foo' has already been declared
......
// Copyright 2018 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.
//
// MODULE
export default x = 1;
export default x = 1;
*%(basename)s:8: SyntaxError: Identifier '*default*' has already been declared
*%(basename)s:6: SyntaxError: Identifier '*default*' has already been declared
export default x = 1;
^^^^^^^^^^^^^
SyntaxError: Identifier '*default*' has already been declared
......@@ -35,7 +35,6 @@ from testrunner.outproc import message
INVALID_FLAGS = ["--enable-slow-asserts"]
MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
class TestSuite(testsuite.TestSuite):
......@@ -56,9 +55,7 @@ class TestCase(testcase.D8TestCase):
def _parse_source_files(self, source):
files = []
if MODULE_PATTERN.search(source):
files.append("--module")
files.append(os.path.join(self.suite.root, self.path + ".js"))
files.append(self._get_source_path())
return files
def _expected_fail(self):
......@@ -81,7 +78,13 @@ class TestCase(testcase.D8TestCase):
return self._source_flags
def _get_source_path(self):
return os.path.join(self.suite.root, self.path + self._get_suffix())
base_path = os.path.join(self.suite.root, self.path)
# Try .js first, and fall back to .mjs.
# TODO(v8:9406): clean this up by never separating the path from
# the extension in the first place.
if os.path.exists(base_path + self._get_suffix()):
return base_path + self._get_suffix()
return base_path + '.mjs'
def skip_predictable(self):
# Message tests expected to fail don't print allocation output for
......
......@@ -5,8 +5,8 @@
// Flags: --allow-natives-syntax --harmony-dynamic-import
var error1, error2;
import('modules-skip-12.js').catch(e => error1 = e);
import('modules-skip-12.js').catch(e => error2 = e);
import('modules-skip-12.mjs').catch(e => error1 = e);
import('modules-skip-12.mjs').catch(e => error2 = e);
%PerformMicrotaskCheckpoint();
assertEquals(error1, error2);
......
......@@ -5,8 +5,8 @@
// Flags: --allow-natives-syntax --harmony-dynamic-import
var error1, error2;
import('modules-skip-11.js').catch(e => error1 = e);
import('modules-skip-11.js').catch(e => error2 = e);
import('modules-skip-11.mjs').catch(e => error1 = e);
import('modules-skip-11.mjs').catch(e => error2 = e);
%PerformMicrotaskCheckpoint();
assertEquals(error1, error2);
......
......@@ -5,8 +5,8 @@
// Flags: --allow-natives-syntax --harmony-dynamic-import
var error1, error2;
import('modules-skip-10.js').catch(e => error1 = e);
import('modules-skip-10.js').catch(e => error2 = e);
import('modules-skip-10.mjs').catch(e => error1 = e);
import('modules-skip-10.mjs').catch(e => error2 = e);
%PerformMicrotaskCheckpoint();
assertEquals(error1, error2);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment