Reuse fixture

This commit is contained in:
Leo Balter 2018-10-12 15:32:38 -04:00
parent 1eb6c6a546
commit b7e0a48725
5 changed files with 51 additions and 33 deletions

View File

@ -18,19 +18,25 @@ flags: [noStrict]
---*/
//- import
import('./delete-exported-init_FIXTURE.js')
import('./module-code_FIXTURE.js')
//- body
assert.sameValue(delete ns.default, false, 'delete: default');
assert.sameValue(
Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default'
);
assert.sameValue(ns.default, 42, 'binding unmodified: default');
assert.sameValue(delete ns.local1, false, 'delete: local1');
assert.sameValue(
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
);
assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1');
assert.sameValue(delete ns.renamed, false, 'delete: renamed');
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed');
assert.sameValue(delete ns.indirect, false, 'delete: indirect');
assert.sameValue(
@ -38,4 +44,4 @@ assert.sameValue(
false,
'Reflect.deleteProperty: indirect'
);
assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect');

View File

@ -18,15 +18,23 @@ flags: [onlyStrict]
---*/
//- import
import('./delete-exported-init_FIXTURE.js')
import('./module-code_FIXTURE.js')
//- body
assert.throws(TypeError, function() {
delete ns.default;
}, 'delete: default');
assert.sameValue(
Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default'
);
assert.sameValue(ns.default, 42, 'binding unmodified: default');
assert.throws(TypeError, function() {
delete ns.local1;
}, 'delete: local1');
assert.sameValue(
Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
);
assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1');
assert.throws(TypeError, function() {
delete ns.renamed;
@ -34,7 +42,7 @@ assert.throws(TypeError, function() {
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed');
assert.throws(TypeError, function() {
delete ns.indirect;
@ -44,4 +52,4 @@ assert.sameValue(
false,
'Reflect.deleteProperty: indirect'
);
assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect');

View File

@ -5,6 +5,8 @@ desc: imported object properties descriptors
template: namespace
---*/
// exports: default === 42, local1 === 'Test262', renamed === 'TC39', indirect === 'Test262'
//- import
import('./module-code_FIXTURE.js')
//- body
@ -14,21 +16,28 @@ import('./module-code_FIXTURE.js')
// object does not.
var desc = Object.getOwnPropertyDescriptor(ns, 'default');
assert.sameValue(desc.value, 42, 'default value is 42');
assert.sameValue(desc.enumerable, true, 'default reports as enumerable');
assert.sameValue(desc.writable, true, 'default reports as writable');
assert.sameValue(desc.configurable, false, 'default reports as non-configurable');
assert.sameValue(desc.value, 42, 'default: value is 42');
assert.sameValue(desc.enumerable, true, 'default: is enumerable');
assert.sameValue(desc.writable, true, 'default: is writable');
assert.sameValue(desc.configurable, false, 'default: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns, 'x');
desc = Object.getOwnPropertyDescriptor(ns, 'local1');
assert.sameValue(desc.value, 'Test262', 'x value is "Test262"');
assert.sameValue(desc.enumerable, true, 'x reports as enumerable');
assert.sameValue(desc.writable, true, 'x reports as writable');
assert.sameValue(desc.configurable, false, 'x reports as non-configurable');
assert.sameValue(desc.value, 'Test262', 'local1: value is "Test262"');
assert.sameValue(desc.enumerable, true, 'local1: is enumerable');
assert.sameValue(desc.writable, true, 'local1: is writable');
assert.sameValue(desc.configurable, false, 'local1: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns, 'z');
desc = Object.getOwnPropertyDescriptor(ns, 'renamed');
assert.sameValue(desc.value, 42, 'z value is 42');
assert.sameValue(desc.enumerable, true, 'z reports as enumerable');
assert.sameValue(desc.writable, true, 'z reports as writable');
assert.sameValue(desc.configurable, false, 'z reports as non-configurable');
assert.sameValue(desc.value, 'TC39', 'renamed: value is TC39"');
assert.sameValue(desc.enumerable, true, 'renamed: is enumerable');
assert.sameValue(desc.writable, true, 'renamed: is writable');
assert.sameValue(desc.configurable, false, 'renamed: is non-configurable');
desc = Object.getOwnPropertyDescriptor(ns, 'indirect:');
assert.sameValue(desc.value, 'Test262', 'indirect: value is Test262"');
assert.sameValue(desc.enumerable, true, 'indirect: is enumerable');
assert.sameValue(desc.writable, true, 'indirect: is writable');
assert.sameValue(desc.configurable, false, 'indirect: is non-configurable');

View File

@ -1,7 +0,0 @@
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
export var local1 = 333;
var local2 = 444;
export { local2 as renamed };
export { local1 as indirect } from './delete-exported-init_FIXTURE.js';

View File

@ -1,8 +1,10 @@
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
const x = 'Test262';
const y = 42;
// exports: default === 42, local1 === 'Test262', renamed === 'TC39', indirect === 'Test262'
export default y;
export { x, y as z };
export var local1 = 'Test262';
var local2 = 'TC39';
export { local2 as renamed };
export { local1 as indirect } from './module-code_FIXTURE.js';
export default 42;