OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 22 matching lines...) Expand all Loading... |
33 assertTrue(!!"..foo*bar".match(re)); | 33 assertTrue(!!"..foo*bar".match(re)); |
34 | 34 |
35 var plain = /foobar/; | 35 var plain = /foobar/; |
36 | 36 |
37 assertTrue(!!"foobar".match(plain)); | 37 assertTrue(!!"foobar".match(plain)); |
38 assertTrue(!!"..foobar".match(plain)); | 38 assertTrue(!!"..foobar".match(plain)); |
39 | 39 |
40 var sticky = /foo.bar/y; | 40 var sticky = /foo.bar/y; |
41 | 41 |
42 assertTrue(!!"foo*bar".match(sticky)); | 42 assertTrue(!!"foo*bar".match(sticky)); |
43 assertEquals(0, sticky.lastIndex); | 43 assertEquals(7, sticky.lastIndex); |
44 assertFalse(!!"..foo*bar".match(sticky)); | 44 assertFalse(!!"..foo*bar".match(sticky)); |
45 | 45 |
46 var stickyplain = /foobar/y; | 46 var stickyplain = /foobar/y; |
47 | 47 |
48 assertTrue(!!"foobar".match(stickyplain)); | 48 assertTrue(!!"foobar".match(stickyplain)); |
49 assertEquals(0, stickyplain.lastIndex); | 49 assertEquals(6, stickyplain.lastIndex); |
50 assertFalse(!!"..foobar".match(stickyplain)); | 50 assertFalse(!!"..foobar".match(stickyplain)); |
51 | 51 |
52 var global = /foo.bar/g; | 52 var global = /foo.bar/g; |
53 | 53 |
54 assertTrue(global.test("foo*bar")); | 54 assertTrue(global.test("foo*bar")); |
55 assertFalse(global.test("..foo*bar")); | 55 assertFalse(global.test("..foo*bar")); |
56 global.lastIndex = 0; | 56 global.lastIndex = 0; |
57 assertTrue(global.test("..foo*bar")); | 57 assertTrue(global.test("..foo*bar")); |
58 | 58 |
59 var plainglobal = /foobar/g; | 59 var plainglobal = /foobar/g; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // beginning of a line. | 123 // beginning of a line. |
124 var hat = /^foo/y; | 124 var hat = /^foo/y; |
125 hat.lastIndex = 2; | 125 hat.lastIndex = 2; |
126 assertFalse(hat.test("..foo")); | 126 assertFalse(hat.test("..foo")); |
127 | 127 |
128 var mhat = /^foo/my; | 128 var mhat = /^foo/my; |
129 mhat.lastIndex = 2; | 129 mhat.lastIndex = 2; |
130 assertFalse(mhat.test("..foo")); | 130 assertFalse(mhat.test("..foo")); |
131 mhat.lastIndex = 2; | 131 mhat.lastIndex = 2; |
132 assertTrue(mhat.test(".\nfoo")); | 132 assertTrue(mhat.test(".\nfoo")); |
OLD | NEW |