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

Unified Diff: test/webkit/fast/js/string-link.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-fontsize-expected.txt ('k') | test/webkit/fast/js/string-link-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-link.js
diff --git a/test/webkit/continue-break-multiple-labels.js b/test/webkit/fast/js/string-link.js
similarity index 55%
copy from test/webkit/continue-break-multiple-labels.js
copy to test/webkit/fast/js/string-link.js
index 69d0834ffca8c09484c39bb8cde9672c8540056a..8b96915be1edab11efb20ea5010ecb7ba09d7e86 100644
--- a/test/webkit/continue-break-multiple-labels.js
+++ b/test/webkit/fast/js/string-link.js
@@ -22,90 +22,35 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description(
-'This test checks break and continue behaviour in the presence of multiple labels.'
+'This is a test case for String.prototype.link(href).'
);
-function test1()
-{
- var s = "";
+// This test is based on http://mathias.html5.org/tests/javascript/string/.
- a:
- b:
- for (var i = 1; i < 10; i++) {
- if (i == 4)
- continue a;
- s += i;
- }
+// Check that the quotation mark is correctly escaped.
+shouldBe("'_'.link('\"')", '"<a href=\\"&quot;\\">_</a>"');
- return s;
-}
+// Simple case.
+shouldBe("'_'.link('b')", '"<a href=\\"b\\">_</a>"');
-shouldBe("test1()", "'12356789'");
+// Does not escape special characters in `this` value.
+shouldBe("'<'.link('b')", '"<a href=\\"b\\"><</a>"');
-function test2()
-{
- var s = "";
+// First argument gets ToString()ed.
+shouldBe("'_'.link(0x2A)", '"<a href=\\"42\\">_</a>"');
- a:
- b:
- for (var i = 1; i < 10; i++) {
- if (i == 4)
- break a;
- s += i;
- }
+// Check that the quotation mark is correctly escaped.
+shouldBe("'_'.link('\"')", '"<a href=\\"&quot;\\">_</a>"');
+shouldBe("'_'.link('\" target=\"_blank')", '"<a href=\\"&quot; target=&quot;_blank\\">_</a>"');
- return s;
-}
+// Generic use on Number object.
+shouldBe("String.prototype.link.call(0x2A, 0x2A)", '"<a href=\\"42\\">42</a>"');
-shouldBe("test2()", "'123'");
+// Generic use on non-coercible object `undefined`.
+shouldThrow("String.prototype.link.call(undefined)", '"TypeError: Type error"');
-function test3()
-{
- var i;
- for (i = 1; i < 10; i++) {
- try {
- continue;
- } finally {
- innerLoop:
- while (1) {
- break innerLoop;
- }
- }
- }
+// Generic use on non-coercible object `null`.
+shouldThrow("String.prototype.link.call(null)", '"TypeError: Type error"');
- return i;
-}
-
-shouldBe("test3()", "10");
-
-function test4()
-{
- var i = 0;
-
- a:
- i++;
- while (1) {
- break;
- }
-
- return i;
-}
-
-shouldBe("test4()", "1");
-
-function test5()
-{
- var i = 0;
-
- switch (1) {
- default:
- while (1) {
- break;
- }
- i++;
- }
-
- return i;
-}
-
-shouldBe("test5()", "1");
+// Check link.length.
+shouldBe("String.prototype.link.length", "1");
« no previous file with comments | « test/webkit/fast/js/string-fontsize-expected.txt ('k') | test/webkit/fast/js/string-link-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698