Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1116)

Unified Diff: test/webkit/fast/js/toString-overrides.js

Issue 20280003: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/webkit/fast/js/toString-overrides.js
diff --git a/test/webkit/parser-high-byte-character.js b/test/webkit/fast/js/toString-overrides.js
similarity index 51%
copy from test/webkit/parser-high-byte-character.js
copy to test/webkit/fast/js/toString-overrides.js
index 4e500fa2f67d5faff2a0317fdff547f770784e5b..cf277139bb45c58f2dffc1773753fb5b7b9ffef1 100644
--- a/test/webkit/parser-high-byte-character.js
+++ b/test/webkit/fast/js/toString-overrides.js
@@ -21,27 +21,45 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// 15.4 Array Objects
+// (c) 2001 Harri Porten <porten@kde.org>
+
description(
-"This test checks that high-byte characters in comments do not crash or cause parser errors."
+'This test checks for regression against <a href="https://bugs.webkit.org/show_bug.cgi?id=4147">4147: Array.toString() and toLocaleString() improvements from KDE KJS</a>.'
);
-// Some high-byte characters: ¸´Ñ¡»ò²»¸´Ñ¡ËùÓеÄÁбí¶àÑ¡¿ò
-function runTest(_a, throws)
-{
- testPassed();
+// backup
+var backupNumberToString = Number.prototype.toString;
+var backupNumberToLocaleString = Number.prototype.toLocaleString;
+var backupRegExpToString = RegExp.prototype.toString;
+var backupRegExpToLocaleString = RegExp.prototype.toLocaleString;
+
+// change functions
+Number.prototype.toString = function() { return "toString"; }
+Number.prototype.toLocaleString = function() { return "toLocaleString"; }
+RegExp.prototype.toString = function() { return "toString2"; }
+RegExp.prototype.toLocaleString = function() { return "toLocaleString2"; }
+
+// the tests
+shouldBe("[1].toString()", "'1'");
+shouldBe("[1].toLocaleString()", "'toLocaleString'");
+Number.prototype.toLocaleString = "invalid";
+shouldBe("[1].toLocaleString()", "'1'");
+shouldBe("[/r/].toString()", "'toString2'");
+shouldBe("[/r/].toLocaleString()", "'toLocaleString2'");
+RegExp.prototype.toLocaleString = "invalid";
+shouldBe("[/r/].toLocaleString()", "'toString2'");
+
+var caught = false;
+try {
+[{ toString : 0 }].toString();
+} catch (e) {
+caught = true;
}
+shouldBeTrue("caught");
-/*
-Over 1024 bytes to ensure precompilation caching is triggered.
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXX
-*/
+// restore
+Number.prototype.toString = backupNumberToString;
+Number.prototype.toLocaleString = backupNumberToLocaleString;
+RegExp.prototype.toString = backupRegExpToString;
+RegExp.prototype.toLocaleString = backupRegExpToLocaleString;
« no previous file with comments | « test/webkit/fast/js/toString-exception-expected.txt ('k') | test/webkit/fast/js/toString-overrides-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698