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

Side by Side Diff: LayoutTests/fast/regex/script-tests/lastIndex.js

Issue 20867002: Remove old tests that have been migrated to the v8 repo. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove unused script-tests as well Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 description(
2 "This page tests that a RegExp object's lastIndex behaves like a regular propert y."
3 );
4
5 // lastIndex is not configurable
6 shouldBeFalse("delete /x/.lastIndex");
7 shouldThrow("'use strict'; delete /x/.lastIndex");
8
9 // lastIndex is not enumerable
10 shouldBeTrue("'lastIndex' in /x/");
11 shouldBeTrue("for (property in /x/) if (property === 'lastIndex') throw false; t rue");
12
13 // lastIndex is writable
14 shouldBeTrue("var re = /x/; re.lastIndex = re; re.lastIndex === re");
15
16 // Cannot redefine lastIndex as an accessor
17 shouldThrow("Object.defineProperty(/x/, {get:function(){}})");
18
19 // Cannot redefine lastIndex as enumerable
20 shouldThrow("Object.defineProperty(/x/, 'lastIndex', {enumerable:true}); true");
21 shouldBeTrue("Object.defineProperty(/x/, 'lastIndex', {enumerable:false}); true" );
22
23 // Cannot redefine lastIndex as configurable
24 shouldThrow("Object.defineProperty(/x/, 'lastIndex', {configurable:true}); true" );
25 shouldBeTrue("Object.defineProperty(/x/, 'lastIndex', {configurable:false}); tru e");
26
27 // Can redefine lastIndex as read-only
28 shouldBe("var re = Object.defineProperty(/x/, 'lastIndex', {writable:true}); re. lastIndex = 42; re.lastIndex", '42');
29 shouldBe("var re = Object.defineProperty(/x/, 'lastIndex', {writable:false}); re .lastIndex = 42; re.lastIndex", '0');
30
31 // Can redefine the value
32 shouldBe("var re = Object.defineProperty(/x/, 'lastIndex', {value:42}); re.lastI ndex", '42');
33
34 // Cannot redefine read-only lastIndex as writable
35 shouldThrow("Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writ able:false}), 'lastIndex', {writable:true}); true");
36
37 // Can only redefine the value of a read-only lastIndex as the current value
38 shouldThrow("Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writ able:false}), 'lastIndex', {value:42}); true");
39 shouldBeTrue("Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {wri table:false}), 'lastIndex', {value:0}); true");
40
41 // Trying to run a global regular expression should throw, if lastIndex is read- only
42 shouldBe("Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('')", ' null');
43 shouldBe("Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('x')", '["x"]');
44 shouldThrow("Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('') ");
45 shouldThrow("Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('x' )");
46
47 // Should be able to freeze a regular expression object.
48 shouldBeTrue("var re = /x/; Object.freeze(re); Object.isFrozen(re);");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698