regress-392378.js (1679B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 //----------------------------------------------------------------------------- 7 var BUGNUMBER = 392378; 8 var summary = 'Regular Expression Non-participating Capture Groups are inaccurate in edge cases'; 9 var actual = ''; 10 var expect = ''; 11 12 13 //----------------------------------------------------------------------------- 14 test(); 15 //----------------------------------------------------------------------------- 16 17 function test() 18 { 19 printBugNumber(BUGNUMBER); 20 printStatus (summary); 21 22 expect = ["", undefined, ""] + ''; 23 actual = "y".split(/(x)?\1y/) + ''; 24 reportCompare(expect, actual, summary + ': "y".split(/(x)?\1y/)'); 25 26 expect = ["", undefined, ""] + ''; 27 actual = "y".split(/(x)?y/) + ''; 28 reportCompare(expect, actual, summary + ': "y".split(/(x)?y/)'); 29 30 expect = 'undefined'; 31 actual = "y".replace(/(x)?\1y/, function($0, $1){ return String($1); }) + ''; 32 reportCompare(expect, actual, summary + ': "y".replace(/(x)?\\1y/, function($0, $1){ return String($1); })'); 33 34 expect = 'undefined'; 35 actual = "y".replace(/(x)?y/, function($0, $1){ return String($1); }) + ''; 36 reportCompare(expect, actual, summary + ': "y".replace(/(x)?y/, function($0, $1){ return String($1); })'); 37 38 expect = 'undefined'; 39 actual = "y".replace(/(x)?y/, function($0, $1){ return $1; }) + ''; 40 reportCompare(expect, actual, summary + ': "y".replace(/(x)?y/, function($0, $1){ return $1; })'); 41 }