diff options
Diffstat (limited to 'external/contributions/Google/sputnik_conformance_modified/15_Native/15.5_String_Objects/15.5.4_Properties_of_the_String_Prototype_Object/15.5.4.11_String.prototype.replace/S15.5.4.11_A12.js')
1 files changed, 23 insertions, 0 deletions
diff --git a/external/contributions/Google/sputnik_conformance_modified/15_Native/15.5_String_Objects/15.5.4_Properties_of_the_String_Prototype_Object/15.5.4.11_String.prototype.replace/S15.5.4.11_A12.js b/external/contributions/Google/sputnik_conformance_modified/15_Native/15.5_String_Objects/15.5.4_Properties_of_the_String_Prototype_Object/15.5.4.11_String.prototype.replace/S15.5.4.11_A12.js new file mode 100644 index 000000000..bfc32db70 --- /dev/null +++ b/external/contributions/Google/sputnik_conformance_modified/15_Native/15.5_String_Objects/15.5.4_Properties_of_the_String_Prototype_Object/15.5.4.11_String.prototype.replace/S15.5.4.11_A12.js @@ -0,0 +1,23 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.5.4.11_A12; +* @section: 15.5.4.11; +* @assertion: Call replaceValue passing undefined as the this value; +* @description: replaceValue tests that its this value is undefined; +*/ + +var global = this; +'x'.replace(/x/, function() { + "use strict"; + + if (this === global) { + $FAIL('#1: String replace leaks global'); + } + if (this !== undefined) { + $FAIL('#2: replaceValue should be called with this===undefined. ' + + 'Actual: ' + this); + } + return 'y'; +}); |