Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: test/mjsunit/string-wrapper.js

Issue 1873833002: [elements] Add more tests to increase coverage (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« test/mjsunit/array-splice.js ('K') | « test/mjsunit/delete.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/string-wrapper.js
diff --git a/test/mjsunit/string-wrapper.js b/test/mjsunit/string-wrapper.js
index 2d44eaef8e482778ba5a980c69d81777d76d7d75..d4b65005d3b03db36dcd20a02a7bab03cfd6c375 100644
--- a/test/mjsunit/string-wrapper.js
+++ b/test/mjsunit/string-wrapper.js
@@ -39,3 +39,24 @@ function testStringWrapper(string) {
testStringWrapper(string);
assertEquals(undefined, string[limit]);
})();
+
+
+(function testReconfigureStringWrapperElements() {
+ var s = new String('abc');
+ // Can't reconfigure string contents.
+ assertThrows(() => Object.defineProperty(s, '1', {value: "value"}), TypeError);
+
+ // Configure a property outside the string range
+ var value = 'v1';
+ Object.defineProperty(s, '3', {
+ get: () => {return value},
+ configurable:true
+ });
+ assertEquals('v1', s[3]);
+ value = 'v2';
+ assertEquals('v2', s[3]);
+
+ Object.defineProperty(s, '3', {value: 'v3', configurable: false});
+ assertEquals('v3', s[3]);
+ assertThrows(() => Object.defineProperty(s, '3', {value:2}), TypeError);
+})();
« test/mjsunit/array-splice.js ('K') | « test/mjsunit/delete.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698