| 1 |
// |reftest| module |
| 2 |
// Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 3 |
// This code is governed by the BSD license found in the LICENSE file. |
| 4 |
/*--- |
| 5 |
esid: sec-module-namespace-exotic-objects-set-p-v-receiver |
| 6 |
description: The [[Set]] internal method consistently returns `false` |
| 7 |
info: | |
| 8 |
1. Return false. |
| 9 |
flags: [module] |
| 10 |
features: [Reflect, Symbol, Symbol.toStringTag] |
| 11 |
---*/ |
| 12 |
|
| 13 |
import * as ns from './set.js'; |
| 14 |
export var local1 = null; |
| 15 |
var local2 = null; |
| 16 |
export { local2 as renamed }; |
| 17 |
export { local1 as indirect } from './set.js'; |
| 18 |
var sym = Symbol('test262'); |
| 19 |
|
| 20 |
assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1'); |
| 21 |
assert.throws(TypeError, function() { |
| 22 |
ns.local1 = null; |
| 23 |
}, 'AssignmentExpression: local1'); |
| 24 |
|
| 25 |
assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2'); |
| 26 |
assert.throws(TypeError, function() { |
| 27 |
ns.local2 = null; |
| 28 |
}, 'AssignmentExpression: local2'); |
| 29 |
|
| 30 |
assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed'); |
| 31 |
assert.throws(TypeError, function() { |
| 32 |
ns.renamed = null; |
| 33 |
}, 'AssignmentExpression: renamed'); |
| 34 |
|
| 35 |
assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect'); |
| 36 |
assert.throws(TypeError, function() { |
| 37 |
ns.indirect = null; |
| 38 |
}, 'AssignmentExpression: indirect'); |
| 39 |
|
| 40 |
assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default'); |
| 41 |
assert.throws(TypeError, function() { |
| 42 |
ns.default = null; |
| 43 |
}, 'AssignmentExpression: default'); |
| 44 |
|
| 45 |
assert.sameValue( |
| 46 |
Reflect.set(ns, Symbol.toStringTag), |
| 47 |
false, |
| 48 |
'Reflect.set: Symbol.toStringTag' |
| 49 |
); |
| 50 |
assert.throws(TypeError, function() { |
| 51 |
ns[Symbol.toStringTag] = null; |
| 52 |
}, 'AssignmentExpression: Symbol.toStringTag'); |
| 53 |
|
| 54 |
assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym'); |
| 55 |
assert.throws(TypeError, function() { |
| 56 |
ns[sym] = null; |
| 57 |
}, 'AssignmentExpression: sym'); |
| 58 |
|
| 59 |
reportCompare(0, 0); |