@@ -38,7 +38,6 @@ const run = assert => {
3838 let string = 'ABB\u0041BABAB' ;
3939 assert . same ( string . match ( object ) [ 0 ] , 'AB' , 'S15.5.4.10_A1_T10' ) ;
4040 object = { toString ( ) { throw new Error ( 'intostr' ) ; } } ;
41- string = 'ABB\u0041BABAB' ;
4241 try {
4342 string . match ( object ) ;
4443 assert . avoid ( 'S15.5.4.10_A1_T11 #1 lead to throwing exception' ) ;
@@ -53,7 +52,6 @@ const run = assert => {
5352 throw new Error ( 'intostr' ) ;
5453 } ,
5554 } ;
56- string = 'ABB\u0041BABAB' ;
5755 try {
5856 string . match ( object ) ;
5957 assert . avoid ( 'S15.5.4.10_A1_T12 #1 lead to throwing exception' ) ;
@@ -90,13 +88,11 @@ const run = assert => {
9088 assert . same ( string . match ( / \d / g) [ i ] , matches [ i ] , 'S15.5.4.10_A2_T3 #2' ) ;
9189 }
9290 matches = [ '12' , '34' , '56' , '78' , '90' ] ;
93- string = '123456abcde7890' ;
9491 assert . same ( string . match ( / \d { 2 } / g) . length , 5 , 'S15.5.4.10_A2_T4 #1' ) ;
9592 for ( let i = 0 , { length } = matches ; i < length ; ++ i ) {
9693 assert . same ( string . match ( / \d { 2 } / g) [ i ] , matches [ i ] , 'S15.5.4.10_A2_T4 #2' ) ;
9794 }
9895 matches = [ 'ab' , 'cd' ] ;
99- string = '123456abcde7890' ;
10096 assert . same ( string . match ( / \D { 2 } / g) . length , 2 , 'S15.5.4.10_A2_T5 #1' ) ;
10197 for ( let i = 0 , { length } = matches ; i < length ; ++ i ) {
10298 assert . same ( string . match ( / \D { 2 } / g) [ i ] , matches [ i ] , 'S15.5.4.10_A2_T5 #2' ) ;
@@ -108,7 +104,6 @@ const run = assert => {
108104 assert . same ( string . match ( / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / ) . length , 3 , 'S15.5.4.10_A2_T6 #4' ) ;
109105 assert . same ( string . match ( / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / ) . index , 14 , 'S15.5.4.10_A2_T6 #5' ) ;
110106 assert . same ( string . match ( / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / ) . input , string , 'S15.5.4.10_A2_T6 #6' ) ;
111- string = 'Boston, Mass. 02134' ;
112107 assert . same ( string . match ( / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / g) . length , 1 , 'S15.5.4.10_A2_T7 #1' ) ;
113108 assert . same ( string . match ( / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / g) [ 0 ] , '02134' , 'S15.5.4.10_A2_T7 #2' ) ;
114109 /* IE8- buggy here (empty string instead of `undefined`), but we don't polyfill base `.match` logic
@@ -153,35 +148,25 @@ const run = assert => {
153148 regexp = / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / g;
154149 assert . same ( string . match ( regexp ) . length , 1 , 'S15.5.4.10_A2_T12 #1' ) ;
155150 assert . same ( string . match ( regexp ) [ 0 ] , '02134' , 'S15.5.4.10_A2_T12 #2' ) ;
156- regexp = / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / g;
157151 regexp . lastIndex = 0 ;
158- string = 'Boston, MA 02134' ;
159152 assert . same ( string . match ( regexp ) . length , 1 , 'S15.5.4.10_A2_T13 #1' ) ;
160153 assert . same ( string . match ( regexp ) [ 0 ] , '02134' , 'S15.5.4.10_A2_T13 #2' ) ;
161- string = 'Boston, MA 02134' ;
162- regexp = / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / g;
163154 regexp . lastIndex = string . length ;
164155 assert . same ( string . match ( regexp ) . length , 1 , 'S15.5.4.10_A2_T14 #1' ) ;
165156 assert . same ( string . match ( regexp ) [ 0 ] , '02134' , 'S15.5.4.10_A2_T14 #2' ) ;
166- string = 'Boston, MA 02134' ;
167- regexp = / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / g;
168157 regexp . lastIndex = string . lastIndexOf ( '0' ) ;
169158 assert . same ( string . match ( regexp ) . length , 1 , 'S15.5.4.10_A2_T15 #1' ) ;
170159 assert . same ( string . match ( regexp ) [ 0 ] , '02134' , 'S15.5.4.10_A2_T15 #2' ) ;
171- string = 'Boston, MA 02134' ;
172- regexp = / ( \d { 5 } ) ( [ - ] ? \d { 4 } ) ? $ / g;
173160 regexp . lastIndex = string . lastIndexOf ( '0' ) + 1 ;
174161 assert . same ( string . match ( regexp ) . length , 1 , 'S15.5.4.10_A2_T16 #1' ) ;
175162 assert . same ( string . match ( regexp ) [ 0 ] , '02134' , 'S15.5.4.10_A2_T16 #2' ) ;
176163 regexp = / 0 ./ ;
177- let number = 10203040506070809000 ;
164+ const number = 10203040506070809000 ;
178165 assert . same ( '' . match . call ( number , regexp ) [ 0 ] , '02' , 'S15.5.4.10_A2_T17 #1' ) ;
179166 assert . same ( '' . match . call ( number , regexp ) . length , 1 , 'S15.5.4.10_A2_T17 #2' ) ;
180167 assert . same ( '' . match . call ( number , regexp ) . index , 1 , 'S15.5.4.10_A2_T17 #3' ) ;
181168 assert . same ( '' . match . call ( number , regexp ) . input , String ( number ) , 'S15.5.4.10_A2_T17 #4' ) ;
182- regexp = / 0 ./ ;
183169 regexp . lastIndex = 0 ;
184- number = 10203040506070809000 ;
185170 assert . same ( '' . match . call ( number , regexp ) [ 0 ] , '02' , 'S15.5.4.10_A2_T18 #1' ) ;
186171 assert . same ( '' . match . call ( number , regexp ) . length , 1 , 'S15.5.4.10_A2_T18 #2' ) ;
187172 assert . same ( '' . match . call ( number , regexp ) . index , 1 , 'S15.5.4.10_A2_T18 #3' ) ;
0 commit comments