| // Copyright (C) 2018 Leo Balter. All rights reserved. |
| // Copyright (C) 2016 the V8 project authors. All rights reserved. |
| // This code is governed by the BSD license found in the LICENSE file. |
| /*--- |
| esid: sec-module-namespace-exotic-objects-set-p-v-receiver |
| desc: > |
| The [[Set]] internal method consistently returns `false` even setting |
| the same value - Strict Mode |
| info: | |
| 1. Return false. |
| features: [Symbol, Symbol.toStringTag] |
| template: namespace |
| flags: [onlyStrict] |
| ---*/ |
| |
| //- import |
| import('./module-code_FIXTURE.js') |
| //- body |
| assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1'); |
| assert.throws(TypeError, function() { |
| ns.local1 = 'Test262'; |
| }, 'AssignmentExpression: local1'); |
| |
| assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed'); |
| assert.throws(TypeError, function() { |
| ns.renamed = 'TC39'; |
| }, 'AssignmentExpression: renamed'); |
| |
| assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect'); |
| assert.throws(TypeError, function() { |
| ns.indirect = 'Test262'; |
| }, 'AssignmentExpression: indirect'); |
| |
| assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default'); |
| assert.throws(TypeError, function() { |
| ns.default = 42; |
| }, 'AssignmentExpression: default'); |
| |
| assert.sameValue( |
| Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]), |
| false, |
| 'Reflect.set: Symbol.toStringTag' |
| ); |
| assert.throws(TypeError, function() { |
| ns[Symbol.toStringTag] = ns[Symbol.toStringTag]; |
| }, 'AssignmentExpression: Symbol.toStringTag'); |