зеркало из https://github.com/mozilla/pjs.git
Corrected tests to match ECMA - unmatched paren contents need to have the
value 'undefined' rather than an empty string.
This commit is contained in:
Родитель
23fa8265b0
Коммит
b42c0eab50
|
@ -46,12 +46,12 @@
|
|||
"/([\d]{5})([-\ ]?[\d]{4})?$/",
|
||||
"Boston, Mass. 02134",
|
||||
14,
|
||||
["02134", "02134"]);
|
||||
["02134", "02134", undefined]);
|
||||
|
||||
AddGlobalRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/g,
|
||||
"/([\d]{5})([-\ ]?[\d]{4})?$/g",
|
||||
"Boston, Mass. 02134",
|
||||
["02134", ]);
|
||||
["02134"]);
|
||||
|
||||
// set the value of lastIndex
|
||||
re = /([\d]{5})([-\ ]?[\d]{4})?$/;
|
||||
|
@ -63,7 +63,7 @@
|
|||
"re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex =0",
|
||||
s,
|
||||
s.lastIndexOf("0"),
|
||||
["02134", "02134"]);
|
||||
["02134", "02134", undefined]);
|
||||
|
||||
|
||||
re.lastIndex = s.length;
|
||||
|
@ -73,7 +73,7 @@
|
|||
s.length,
|
||||
s,
|
||||
s.lastIndexOf("0"),
|
||||
["02134", "02134"] );
|
||||
["02134", "02134", undefined] );
|
||||
|
||||
re.lastIndex = s.lastIndexOf("0");
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
|||
s.lastIndexOf("0"),
|
||||
s,
|
||||
s.lastIndexOf("0"),
|
||||
["02134", "02134"]);
|
||||
["02134", "02134", undefined]);
|
||||
|
||||
re.lastIndex = s.lastIndexOf("0") + 1;
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
|||
s.lastIndexOf("0") +1,
|
||||
s,
|
||||
s.lastIndexOf("0"),
|
||||
["02134", "02134"]);
|
||||
["02134", "02134", undefined]);
|
||||
|
||||
test();
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ status = inSection(1);
|
|||
pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/;
|
||||
string = '<p>Some<br />test</p>';
|
||||
actualmatch = string.match(pattern);
|
||||
expectedmatch = Array('<p>', cnEmptyString, 'p');
|
||||
expectedmatch = Array('<p>', undefined, 'p');
|
||||
addThis();
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ status = inSection(3);
|
|||
pattern = /(\S+)????(.*)/;
|
||||
string= 'Test this';
|
||||
actualmatch = string.match(pattern);
|
||||
expectedmatch = Array(string, cnEmptyString, string);
|
||||
expectedmatch = Array(string, undefined, string);
|
||||
addThis();
|
||||
|
||||
status = inSection(4);
|
||||
|
|
|
@ -69,7 +69,7 @@ pattern = /^(A)?(A.*)$/;
|
|||
status = inSection(3);
|
||||
string = 'A';
|
||||
actualmatch = string.match(pattern);
|
||||
expectedmatch = Array('A', cnEmptyString, 'A'); // 'altruistic' case: see above
|
||||
expectedmatch = Array('A', undefined, 'A'); // 'altruistic' case: see above
|
||||
addThis();
|
||||
|
||||
|
||||
|
@ -92,7 +92,7 @@ var strR = 'aaAAaaaf;lrlrzs';
|
|||
status = inSection(6);
|
||||
string = strL + 'A' + strR;
|
||||
actualmatch = string.match(pattern);
|
||||
expectedmatch = Array('A' + strR, cnEmptyString, 'A' + strR); // 'altruistic' case: see above
|
||||
expectedmatch = Array('A' + strR, undefined, 'A' + strR); // 'altruistic' case: see above
|
||||
addThis();
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
// 'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))
|
||||
testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))",
|
||||
String(["Bob","","Bob"]), String('Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))));
|
||||
String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))));
|
||||
|
||||
// 'abcdef'.match(new RegExp('abc|bcd|cde|def'))
|
||||
testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(new RegExp('abc|bcd|cde|def'))",
|
||||
|
@ -72,7 +72,7 @@
|
|||
|
||||
// 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)
|
||||
testcases[count++] = new TestCase ( SECTION, "'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)",
|
||||
String(["Bob","","Bob"]), String('Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)));
|
||||
String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)));
|
||||
|
||||
// 'abcdef'.match(/abc|bcd|cde|def/)
|
||||
testcases[count++] = new TestCase ( SECTION, "'abcdef'.match(/abc|bcd|cde|def/)",
|
||||
|
|
Загрузка…
Ссылка в новой задаче