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

Unified Diff: test/webkit/fast/js/string-fontcolor.js

Issue 21070002: 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
« no previous file with comments | « test/webkit/fast/js/string-anchor-expected.txt ('k') | test/webkit/fast/js/string-fontcolor-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/webkit/fast/js/string-fontcolor.js
diff --git a/test/webkit/cached-call-uninitialized-arguments.js b/test/webkit/fast/js/string-fontcolor.js
similarity index 56%
copy from test/webkit/cached-call-uninitialized-arguments.js
copy to test/webkit/fast/js/string-fontcolor.js
index de3f098800776a4d3ea0493b4db7876824f0d1e4..67f4ef2e07826f59779f19bb47a51f1d33b1ac2d 100644
--- a/test/webkit/cached-call-uninitialized-arguments.js
+++ b/test/webkit/fast/js/string-fontcolor.js
@@ -22,45 +22,32 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-"This test checks that uninitialized parameters for cached call functions correctly defaults to undefined."
-
+'This is a test case for String.prototype.fontcolor(color).'
);
-function doForEach(arr) {
- function callback(element, index, array, arg4, arg5, arg6) {
+// This test is based on http://mathias.html5.org/tests/javascript/string/.
+
+// Simple case.
+shouldBe("'_'.fontcolor('b')", '"<font color=\\"b\\">_</font>"');
+
+// Does not escape special characters in `this` value.
+shouldBe("'<'.fontcolor('b')", '"<font color=\\"b\\"><</font>"');
- function shouldBeUndefined(_a) {
- var exception;
- var _av;
- try {
- _av = eval(_a);
- } catch (e) {
- exception = e;
- }
+// First argument gets ToString()ed.
+shouldBe("'_'.fontcolor(0x2A)", '"<font color=\\"42\\">_</font>"');
- if (exception)
- testFailed(_a + " should be undefined. Threw exception " + exception);
- else if (typeof _av == "undefined")
- testPassed(_a + " is undefined.");
- else
- testFailed(_a + " should be undefined. Was " + _av);
- }
+// Check that the quotation mark is correctly escaped.
+shouldBe("'_'.fontcolor('\"')", '"<font color=\\"&quot;\\">_</font>"');
+shouldBe("'_'.fontcolor('\" size=\"2px')", '"<font color=\\"&quot; size=&quot;2px\\">_</font>"');
- shouldBeUndefined("arg4");
- shouldBeUndefined("arg5");
- shouldBeUndefined("arg6");
- }
+// Generic use on Number object.
+shouldBe("String.prototype.fontcolor.call(0x2A, 0x2A)", '"<font color=\\"42\\">42</font>"');
- arr.forEach(callback);
-}
+// Generic use on non-coercible object `undefined`.
+shouldThrow("String.prototype.fontcolor.call(undefined)", '"TypeError: Type error"');
-function callAfterRecursingForDepth(depth, func, arr) {
- if (depth > 0) {
- callAfterRecursingForDepth(depth - 1, func, arr);
- } else {
- func(arr);
- }
-}
+// Generic use on non-coercible object `null`.
+shouldThrow("String.prototype.fontcolor.call(null)", '"TypeError: Type error"');
-var arr = [1];
-callAfterRecursingForDepth(20, doForEach, arr);
+// Check fontcolor.length.
+shouldBe("String.prototype.fontcolor.length", "1");
« no previous file with comments | « test/webkit/fast/js/string-anchor-expected.txt ('k') | test/webkit/fast/js/string-fontcolor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698