Ticket #3504: 3504_2.patch
File 3504_2.patch, 1.8 KB (added by , 15 years ago) |
---|
-
_source/includes/scriptcompressor.js
881 881 { 882 882 var id = String( ids[ counter++ ] ); 883 883 884 if ( isReserved( id ) || !/^(?:(?:[a-zA-Z$_][\w$_]*)|(?: \d+))$/.test( id ) )884 if ( isReserved( id ) || !/^(?:(?:[a-zA-Z$_][\w$_]*)|(?:0|[1-9]\d*))$/.test( id ) ) 885 885 outString( id ); 886 886 else 887 887 out( id ); -
test/test.js
267 267 268 268 [ "if(a){if(B)doB();}else if(c)doC();" ], 269 269 270 [ "var a={'0':'0'};", 271 "var a={0:'0'};" ], 272 273 [ "var a={'1':'1'};", 274 "var a={1:'1'};" ], 275 276 [ "var a={'0123':'0123'};", 277 "var a={'0123':'0123'};" ], 278 279 [ "var a={'123':'123'};", 280 "var a={123:'123'};" ] 270 281 ]; 271 282 272 283 var tests = … … 292 303 // Create the auto tests. 293 304 function createAutoTest( counter, source, expected ) 294 305 { 295 tests[ 'autoTest' + ( counter + 1000 ).toString().substr( 1 ) ] = function()306 var test = tests[ 'autoTest' + ( counter + 1000 ).toString().substr( 1 ) ] = function() 296 307 { 297 308 assertEquals( expected || source, CKPACKAGER.scriptCompressor.compress( source, true, null, true ) ); 298 309 }; 310 311 test.source = source; 312 test.expected = expected || source; 299 313 } 300 314 301 315 for ( var i = 0 ; i < autoTests.length ; i++ ) … … 312 326 try 313 327 { 314 328 tests[ test ](); 315 print( 'PASSED: ' + test);329 print( 'PASSED: (' + test + ') ' + tests[ test ].expected ); 316 330 passCount++; 317 331 } 318 332 catch ( error ) 319 333 { 320 print( 'FAILED: ' + test);334 print( 'FAILED: (' + test + ')' ); 321 335 322 336 if ( !error.expected ) 323 337 throw error;