| 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=\\""\\">_</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=\\""\\">_</a>"');
|
| +shouldBe("'_'.link('\" target=\"_blank')", '"<a href=\\"" target="_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");
|
|
|