OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 for (var i = 1; i <= 9; i++) { | 59 for (var i = 1; i <= 9; i++) { |
60 if (i <= captures.length) { | 60 if (i <= captures.length) { |
61 assertEquals(captures[i - 1], RegExp["$" + i], name + "-capture-" + i); | 61 assertEquals(captures[i - 1], RegExp["$" + i], name + "-capture-" + i); |
62 } else { | 62 } else { |
63 assertEquals("", RegExp["$" + i], name + "-nocapture-" + i); | 63 assertEquals("", RegExp["$" + i], name + "-nocapture-" + i); |
64 } | 64 } |
65 } | 65 } |
66 assertEquals(undefined, RegExp.$10, name + "-nocapture-10"); | 66 assertEquals(undefined, RegExp.$10, name + "-nocapture-10"); |
67 | 67 |
68 assertEquals(input, RegExp.input, name + "-input"); | 68 assertEquals(input, RegExp.input, name + "-input"); |
69 assertEquals(input, RegExp.$input, name + "-$input"); | |
70 assertEquals(input, RegExp.$_, name + "-$_"); | 69 assertEquals(input, RegExp.$_, name + "-$_"); |
71 | 70 |
72 assertEquals(preMatch, RegExp["$`"], name + "-$`"); | 71 assertEquals(preMatch, RegExp["$`"], name + "-$`"); |
73 assertEquals(preMatch, RegExp.leftContext, name + "-leftContex"); | 72 assertEquals(preMatch, RegExp.leftContext, name + "-leftContex"); |
74 | 73 |
75 assertEquals(postMatch, RegExp["$'"], name + "-$'"); | 74 assertEquals(postMatch, RegExp["$'"], name + "-$'"); |
76 assertEquals(postMatch, RegExp.rightContext, name + "-rightContex"); | 75 assertEquals(postMatch, RegExp.rightContext, name + "-rightContex"); |
77 | 76 |
78 assertEquals(lastParen, RegExp["$+"], name + "-$+"); | 77 assertEquals(lastParen, RegExp["$+"], name + "-$+"); |
79 assertEquals(lastParen, RegExp.lastParen, name + "-lastParen"); | 78 assertEquals(lastParen, RegExp.lastParen, name + "-lastParen"); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 [], 3, 5); | 139 [], 3, 5); |
141 | 140 |
142 | 141 |
143 // Atom, global | 142 // Atom, global |
144 | 143 |
145 var re_atomg = /an/g; | 144 var re_atomg = /an/g; |
146 | 145 |
147 testMatch("Global-Atom", stringSample, re_atomg, | 146 testMatch("Global-Atom", stringSample, re_atomg, |
148 ["an", "an", "an", "an"], | 147 ["an", "an", "an", "an"], |
149 [], 25, 27); | 148 [], 25, 27); |
OLD | NEW |