2016-10-07 19:37:04 +00:00
|
|
|
// 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.
|
|
|
|
|
2019-06-27 10:49:03 +00:00
|
|
|
import * as foo from "modules-namespace4.mjs";
|
2016-10-07 19:37:04 +00:00
|
|
|
|
|
|
|
assertSame(undefined, a);
|
|
|
|
assertThrows(() => b, ReferenceError);
|
2016-10-10 16:56:15 +00:00
|
|
|
assertThrows(() => B, ReferenceError);
|
2016-10-07 19:37:04 +00:00
|
|
|
assertThrows(() => c, ReferenceError);
|
|
|
|
assertEquals(45, d());
|
|
|
|
|
|
|
|
assertSame(undefined, foo.a);
|
|
|
|
assertThrows(() => foo.b, ReferenceError);
|
2016-10-10 16:56:15 +00:00
|
|
|
assertThrows(() => foo.B, ReferenceError);
|
2016-10-07 19:37:04 +00:00
|
|
|
assertThrows(() => foo.c, ReferenceError);
|
|
|
|
assertEquals(45, foo.d());
|
|
|
|
assertThrows(() => foo.default, ReferenceError);
|
|
|
|
assertSame(undefined, foo.doesnotexist);
|
|
|
|
|
2016-10-10 16:56:15 +00:00
|
|
|
Function("Foo", " \
|
|
|
|
with (Foo) { \
|
|
|
|
assertEquals(undefined, a); \
|
|
|
|
assertThrows(() => b, ReferenceError); \
|
|
|
|
assertThrows(() => B, ReferenceError); \
|
|
|
|
assertThrows(() => c, ReferenceError); \
|
|
|
|
assertEquals(45, d()); \
|
|
|
|
}")(foo);
|
|
|
|
|
2016-10-07 19:37:04 +00:00
|
|
|
export var a = 42;
|
|
|
|
export let b = 43;
|
2016-10-10 16:56:15 +00:00
|
|
|
export {b as B};
|
2016-10-07 19:37:04 +00:00
|
|
|
export const c = 44;
|
|
|
|
export function d() { return 45 };
|
|
|
|
export default 46;
|
|
|
|
|
|
|
|
assertEquals(42, a);
|
|
|
|
assertEquals(43, b);
|
|
|
|
assertEquals(44, c);
|
|
|
|
assertEquals(45, d());
|
|
|
|
|
|
|
|
assertEquals(42, foo.a);
|
|
|
|
assertEquals(43, foo.b);
|
2016-10-10 16:56:15 +00:00
|
|
|
assertEquals(43, foo.B);
|
2016-10-07 19:37:04 +00:00
|
|
|
assertEquals(44, foo.c);
|
|
|
|
assertEquals(45, foo.d());
|
|
|
|
assertEquals(46, foo.default);
|
|
|
|
assertSame(undefined, foo.doesnotexist);
|
2016-10-10 16:56:15 +00:00
|
|
|
|
|
|
|
Function("Foo", " \
|
|
|
|
with (Foo) { \
|
|
|
|
assertEquals(42, a); \
|
|
|
|
assertEquals(43, b); \
|
|
|
|
assertEquals(43, B); \
|
|
|
|
assertEquals(44, c); \
|
|
|
|
assertEquals(45, d()); \
|
|
|
|
}")(foo);
|