test262/src/dynamic-import/ns-delete-exported-init-strict.case
2018-10-12 15:32:38 -04:00

56 lines
1.7 KiB
Plaintext

// Copyright (C) 2016 the V8 project authors. All rights reserved.
// Copyright (C) 2018 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-module-namespace-exotic-objects-delete-p
desc: >
The [[Delete]] behavior for a key that describes an initialized exported
binding on strict mode
info: |
[...]
2. If Type(P) is Symbol, then
a. Return ? OrdinaryDelete(O, P).
3. Let exports be O.[[Exports]].
4. If P is an element of exports, return false.
5. Return true.
template: namespace
flags: [onlyStrict]
---*/
//- import
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, 'Test262', 'binding unmodified: local1');
assert.throws(TypeError, function() {
delete ns.renamed;
}, 'delete: renamed');
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed');
assert.throws(TypeError, function() {
delete ns.indirect;
}, 'delete: indirect');
assert.sameValue(
Reflect.deleteProperty(ns, 'indirect'),
false,
'Reflect.deleteProperty: indirect'
);
assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect');