[webkit-changes] cvs commit: WebCore/layout-tests/fast/js string-replace-2-expected.txt string-replace-2.html

Darin darin at opensource.apple.com
Wed Jun 22 10:29:28 PDT 2005


darin       05/06/22 10:29:28

  Modified:    .        ChangeLog
  Added:       layout-tests/fast/js string-replace-2-expected.txt
                        string-replace-2.html
  Log:
          - added test case for JavaScriptCore fix
  
          * layout-tests/fast/js/string-replace-2-expected.txt: Added.
          * layout-tests/fast/js/string-replace-2.html: Added.
  
  Revision  Changes    Path
  1.4300    +7 -0      WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4299
  retrieving revision 1.4300
  diff -u -r1.4299 -r1.4300
  --- ChangeLog	22 Jun 2005 16:37:59 -0000	1.4299
  +++ ChangeLog	22 Jun 2005 17:29:24 -0000	1.4300
  @@ -1,5 +1,12 @@
   2005-06-22  Darin Adler  <darin at apple.com>
   
  +        - added test case for JavaScriptCore fix
  +
  +        * layout-tests/fast/js/string-replace-2-expected.txt: Added.
  +        * layout-tests/fast/js/string-replace-2.html: Added.
  +
  +2005-06-22  Darin Adler  <darin at apple.com>
  +
           Reviewed by John Sullivan.
   
           Test cases added:
  
  
  
  1.1                  WebCore/layout-tests/fast/js/string-replace-2-expected.txt
  
  Index: string-replace-2-expected.txt
  ===================================================================
  String.replace(…) test
  
  Support for String.replace('…','…')
  
  var foo = 'It\'s the end of the world as we know it, and I feel fine.';
  var result = foo.replace('end','BEGINNING');
  Expected result: "It's the BEGINNING of the world as we know it, and I feel fine."
  Your result: "It's the BEGINNING of the world as we know it, and I feel fine."
  
  Support for String.replace(/…/,'…')
  
  var vowels = /[aeiou]/gi;
  result = foo.replace(vowels,'-');
  Expected result: "-t's th- -nd -f th- w-rld -s w- kn-w -t, -nd - f--l f-n-."
  Your result: "-t's th- -nd -f th- w-rld -s w- kn-w -t, -nd - f--l f-n-."
  
  Support for String.replace(/…/,myFunction)
  
  function Capitalize(s){
          return s.toUpperCase();
  }
  result = foo.replace(vowels,Capitalize);
  Expected result: "It's thE End Of thE wOrld As wE knOw It, And I fEEl fInE."
  Your result: "It's thE End Of thE wOrld As wE knOw It, And I fEEl fInE."
  
  Support for String.replace(/…/,myFunction), using RegExp
  
  function Capitalize(){
          return RegExp.$1.toUpperCase()+RegExp.$2;
  }
  result = foo.replace(/([aeiou])([a-z])/g,Capitalize);
  Expected result: "It's the End Of the wOrld As we knOw It, And I fEel fIne."
  Your result: "It's the End Of the wOrld As we knOw It, And I fEel fIne."
  
  Support for String.replace(/…/,myFunction), using parameters
  
  function Capitalize(orig,re1,re2){
          return re1.toUpperCase()+re2;
  }
  result = foo.replace(/([aeiou])([a-z])/g,Capitalize);
  Expected result: "It's the End Of the wOrld As we knOw It, And I fEel fIne."
  Your result: "It's the End Of the wOrld As we knOw It, And I fEel fIne."
  
  
  
  
  
  1.1                  WebCore/layout-tests/fast/js/string-replace-2.html
  
  Index: string-replace-2.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
  <html>
  <head>
  	<title>String.replace(&hellip;) test</title>
  	<style type="text/css" media="all">
  		label	{ background-color:yellow }
  	</style>
  </head>
  <body>
  <h1>String.replace(&hellip;) test</h1>
  
  <script>
  if (window.layoutTestController) layoutTestController.dumpAsText();
  </script>
  
  <div id="pagecontent">
  <h2>Support for <code>String.replace('&hellip;','&hellip;')</code></h2>
  <pre><code>var foo = 'It\'s the end of the world as we know it, and I feel fine.';
  var result = foo.replace('end','BEGINNING');</code></pre>
  
  <p><label><b>Expected</b> result:</label> "It's the BEGINNING of the world as we know it, and I feel fine."<br>
  <script type="text/javascript">
  	var foo = "It's the end of the world as we know it, and I feel fine.";
  	var result = foo.replace('end','BEGINNING');
  	document.write('<label><b>Your<\/b> result:<\/label> "'+result+'"');
  </script>
  </p>
  
  <h2>Support for <code>String.replace(/&hellip;/,'&hellip;')</code></h2>
  <pre><code>var vowels = /[aeiou]/gi;
  result = foo.replace(vowels,'-');</code></pre>
  
  <p><label><b>Expected</b> result:</label> "-t's th- -nd -f th- w-rld -s w- kn-w -t, -nd - f--l f-n-."<br>
  <script type="text/javascript">
  	var vowels = /[aeiou]/gi;
  	result = foo.replace(vowels,'-');
  	document.write('<label><b>Your<\/b> result:<\/label> "'+result+'"');
  </script>
  </p>
  
  <h2>Support for <code>String.replace(/&hellip;/,myFunction)</code></h2>
  <pre><code>function Capitalize(s){
  	return s.toUpperCase();
  }
  result = foo.replace(vowels,Capitalize);</code></pre>
  
  <p><label><b>Expected</b> result:</label> "It's thE End Of thE wOrld As wE knOw It, And I fEEl fInE."<br>
  <script type="text/javascript">
  	function Capitalize(s){
  		return s.toUpperCase();
  	}
  	result = foo.replace(vowels,Capitalize);
  	document.write('<label><b>Your<\/b> result:<\/label> "'+result+'"');
  </script>
  </p>
  
  <h2>Support for <code>String.replace(/&hellip;/,myFunction)</code>, using <code>RegExp</code></h2>
  <pre><code>function Capitalize(){
  	return RegExp.$1.toUpperCase()+RegExp.$2;
  }
  result = foo.replace(/([aeiou])([a-z])/g,Capitalize);</code></pre>
  <p><label><b>Expected</b> result:</label> "It's the End Of the wOrld As we knOw It, And I fEel fIne."<br>
  <script type="text/javascript">
  	function Capitalize(){
  		return RegExp.$1.toUpperCase()+RegExp.$2;
  	}
  	result = foo.replace(/([aeiou])([a-z])/g,Capitalize);
  	document.write('<label><b>Your<\/b> result:<\/label> "'+result+'"');
  </script>
  </p>
  
  <h2>Support for <code>String.replace(/&hellip;/,myFunction)</code>, using parameters</h2>
  <pre><code>function Capitalize(orig,re1,re2){
  	return re1.toUpperCase()+re2;
  }
  result = foo.replace(/([aeiou])([a-z])/g,Capitalize);</code></pre>
  
  <p><label><b>Expected</b> result:</label> "It's the End Of the wOrld As we knOw It, And I fEel fIne."<br>
  <script type="text/javascript">
  	function Capitalize(orig,re1,re2){
  		return re1.toUpperCase()+re2;
  	}
  	result = foo.replace(/([aeiou])([a-z])/g,Capitalize);
  	document.write('<label><b>Your<\/b> result:<\/label> "'+result+'"');
  </script>
  </p>
  
  </div>
  
  </body>
  </html>
  
  
  



More information about the webkit-changes mailing list