Changeset 53062 in webkit for trunk/JavaScriptCore/tests


Ignore:
Timestamp:
Jan 10, 2010, 8:55:26 PM (15 years ago)
Author:
[email protected]
Message:

2010-01-10 Kent Hansen <[email protected]>

Reviewed by Darin Adler.

RegExp.prototype.toString returns "" for empty regular expressions
https://bugs.webkit.org/show_bug.cgi?id=33319

"" starts a single-line comment, hence "/(?:)/" should be used, according to ECMA.

  • runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncToString):
  • tests/mozilla/ecma_2/RegExp/properties-001.js: (AddRegExpCases):
  • tests/mozilla/js1_2/regexp/toString.js: Update relevant Mozilla tests (Mozilla has had this behavior since November 2003).

2010-01-10 Kent Hansen <[email protected]>

Reviewed by Darin Adler.

RegExp.prototype.toString returns "" for empty regular expressions
https://bugs.webkit.org/show_bug.cgi?id=33319

Add new test cases and adapt existing ones.

  • fast/js/kde/RegExp-expected.txt:
  • fast/js/kde/script-tests/RegExp.js:
  • fast/js/regexp-compile-expected.txt:
  • fast/js/script-tests/regexp-compile.js:
  • fast/regex/non-pattern-characters-expected.txt:
Location:
trunk/JavaScriptCore/tests/mozilla
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/tests/mozilla/ecma_2/RegExp/properties-001.js

    r17862 r53062  
    5757                 re.source );
    5858
     59/*
     60 * http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed
     61 * the behavior of toString() and toSource() on empty regexps.
     62 * So branch if |s| is the empty string -
     63 */
     64    var S = s? s : '(?:)';
     65
    5966    AddTestCase( re + ".toString()",
    60                  "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
     67                 "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
    6168                 re.toString() );
    6269
  • trunk/JavaScriptCore/tests/mozilla/js1_2/regexp/toString.js

    r53061 r53062  
    4242        var re = new RegExp();
    4343        testcases[count++] = new TestCase ( SECTION, "var re = new RegExp(); re.toString()",
    44                                             '//', re.toString());
     44                                            '/(?:)/', re.toString());
    4545
    4646    // re = /.+/; re.toString();
Note: See TracChangeset for help on using the changeset viewer.