test262/src/dynamic-import/ns-delete-exported-init-strict.case
2018-10-11 16:57:36 -04:00

48 lines
1.4 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('./delete-exported-init_FIXTURE.js')
//- body
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.throws(TypeError, function() {
delete ns.renamed;
}, 'delete: renamed');
assert.sameValue(
Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
);
assert.sameValue(ns.renamed, 444, '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, 333, 'binding unmodified: indirect');