[webkit-changes] cvs commit: LayoutTests/fast/js regexp-caching-expected.txt regexp-caching.html

Geoffrey ggaren at opensource.apple.com
Tue Oct 11 13:57:40 PDT 2005


ggaren      05/10/11 13:57:39

  Modified:    .        ChangeLog
  Added:       fast/js  regexp-caching-expected.txt regexp-caching.html
  Log:
          Added a layout test for the new special properties of the global RegExp object.
          (See JavaSriptCore changelog.)
  
          * fast/js/regexp-caching-expected.txt: Added.
          * fast/js/regexp-caching.html: Added.
  
  Revision  Changes    Path
  1.30      +8 -0      LayoutTests/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/LayoutTests/ChangeLog,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ChangeLog	11 Oct 2005 19:16:40 -0000	1.29
  +++ ChangeLog	11 Oct 2005 20:57:38 -0000	1.30
  @@ -1,3 +1,11 @@
  +2005-10-11  Geoffrey Garen  <ggaren at apple.com>
  +
  +        Added a layout test for the new special properties of the global RegExp object.
  +        (See JavaSriptCore changelog.)
  +
  +        * fast/js/regexp-caching-expected.txt: Added.
  +        * fast/js/regexp-caching.html: Added.
  +
   2005-10-11  Adele Peterson <adele at apple.com>
   
           Rolling out Darin's previous change.
  
  
  
  1.1                  LayoutTests/fast/js/regexp-caching-expected.txt
  
  Index: regexp-caching-expected.txt
  ===================================================================
  This test checks our implementation of the special RegExp member variables.
  
  Properties of RegExp at startup:
  
  input: {} (read-write)
  
  rightContext: {} (read-only)
  
  $1: {} (read-only)
  
  $2: {} (read-only)
  
  $3: {} (read-only)
  
  leftContext: {} (read-only)
  
  lastMatch: {} (read-only)
  
  $6: {} (read-only)
  
  $9: {} (read-only)
  
  multiline: {false} (read-write)
  
  lastParen: {} (read-only)
  
  $4: {} (read-only)
  
  $5: {} (read-only)
  
  $7: {} (read-only)
  
  $8: {} (read-only)
  
  
  Properties of RegExp after /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/.exec(<1234567890>):
  
  input: {<1234567890>}
  
  rightContext: {>}
  
  $1: {1}
  
  $2: {2}
  
  $3: {3}
  
  leftContext: {<}
  
  lastMatch: {1234567890}
  
  $6: {6}
  
  $9: {9}
  
  multiline: {false}
  
  lastParen: {0}
  
  $4: {4}
  
  $5: {5}
  
  $7: {7}
  
  $8: {8}
  
  
  RegExp.$0 does not exist
  
  RegExp.$10 does not exist
  
  RegExp uses RegExp.input
  
  RegExp.multiline coerces values to booleans
  
  RegExp.input coerces values to strings
  
  
  Properties of RegExp after /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/.exec(XXX):
  
  input: {0}
  
  rightContext: {}
  
  $1: {}
  
  $2: {}
  
  $3: {}
  
  leftContext: {0}
  
  lastMatch: {}
  
  $6: {}
  
  $9: {}
  
  multiline: {true}
  
  lastParen: {}
  
  $4: {}
  
  $5: {}
  
  $7: {}
  
  $8: {}
  
  
  ---------- [Cleared RegExp values] ----------
  
  Properties of RegExp after <1234567890>.search(/(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/):
  
  input: {<1234567890>}
  
  rightContext: {>}
  
  $1: {1}
  
  $2: {2}
  
  $3: {3}
  
  leftContext: {<}
  
  lastMatch: {1234567890}
  
  $6: {6}
  
  $9: {9}
  
  multiline: {true}
  
  lastParen: {0}
  
  $4: {4}
  
  $5: {5}
  
  $7: {7}
  
  $8: {8}
  
  
  ---------- [Cleared RegExp values] ----------
  
  Properties of RegExp after <1234567890>.replace(/(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/):
  
  input: {<1234567890>}
  
  rightContext: {>}
  
  $1: {1}
  
  $2: {2}
  
  $3: {3}
  
  leftContext: {<}
  
  lastMatch: {1234567890}
  
  $6: {6}
  
  $9: {9}
  
  multiline: {true}
  
  lastParen: {0}
  
  $4: {4}
  
  $5: {5}
  
  $7: {7}
  
  $8: {8}
  
  
  
  1.1                  LayoutTests/fast/js/regexp-caching.html
  
  Index: regexp-caching.html
  ===================================================================
  <html>
  <head>
  <script>
  function print(message) {
  	var paragraph = document.createElement("p");
  	paragraph.appendChild(document.createTextNode(message));
  	document.getElementById("console").appendChild(paragraph);
  }
  
  function isReadOnly(p) {
      var oldValue = RegExp[p];
      RegExp[p] = !RegExp[p];
      var result = (RegExp[p] == oldValue);
      RegExp[p] = oldValue;
      return result;
  }
  
  function test() {
      if (window.layoutTestController)  
          layoutTestController.dumpAsText();
  
      print("Properties of RegExp at startup:");
      for (var p in RegExp) {
          print(p + ": {" + RegExp[p] + "} " + (isReadOnly(p) ? "(read-only)" : "(read-write)"));
          }
      
      var r = /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/;
      var matchingString = "<1234567890>";
      var unmatchingString = "XXX";
  
      var dummyRegExp = new RegExp();
      var dummyString = "";
      
      print("");
      r.exec(matchingString);
      print("Properties of RegExp after " + r + ".exec(" + matchingString + "):");
      for (var p in RegExp)
          print(p + ": {" + RegExp[p] + "} ");
  
      print("");
      print("RegExp.$0 " + (RegExp.$0 ? "exists" : "does not exist"));
      print("RegExp.$10 " + (RegExp.$10 ? "exists" : "does not exist"));
      print("RegExp " + (r.test() ? "uses" : "doesn't use") + " RegExp.input");
      
      RegExp.multiline = "foo";
      print("RegExp.multiline " + (typeof RegExp.multiline == typeof Boolean() ? "coerces" : "doesn't coerce") + " values to booleans");
      RegExp.input = Number();
      print("RegExp.input " + (typeof RegExp.input == typeof String() ? "coerces" : "doesn't coerce") + " values to strings");
  
      print("");
      r.exec(unmatchingString);
      print("Properties of RegExp after " + r + ".exec(" + unmatchingString + "):");
      for (var p in RegExp)
          print(p + ": {" + RegExp[p] + "} ");
  
      print("");
      print("---------- [Cleared RegExp values] ----------");
      dummyRegExp.exec(dummyString);
      if (RegExp.lastMatch != "")
          print("Clear failed");
  
      matchingString.search(r);
      print("Properties of RegExp after " + matchingString + ".search(" + r + "):");
      for (var p in RegExp)
          print(p + ": {" + RegExp[p] + "} ");
  
      print("");
      print("---------- [Cleared RegExp values] ----------");
      dummyRegExp.exec(dummyString);
  
      matchingString.replace(r);
      print("Properties of RegExp after " + matchingString + ".replace(" + r + "):");
      for (var p in RegExp)
          print(p + ": {" + RegExp[p] + "} ");
  }
  </script>
  </head>
  <body onload="test();">
  <p>
  This test checks our implementation of the special RegExp member variables.
  </p>
  <hr>
  <div id='console'/ style="font-family: courier; font-size: 12">
  </body>
  </html>
  
  
  



More information about the webkit-changes mailing list