| Index: test/webkit/fast/js/string-fontsize.js
|
| diff --git a/test/webkit/fast/js/object-prototype-constructor.js b/test/webkit/fast/js/string-fontsize.js
|
| similarity index 55%
|
| copy from test/webkit/fast/js/object-prototype-constructor.js
|
| copy to test/webkit/fast/js/string-fontsize.js
|
| index d3031ae106a4b27823bf9f22572bd0d4dbbb3c20..e103e5e6bc2c9eb74ef6c32ea2bfb86eca90fe73 100644
|
| --- a/test/webkit/fast/js/object-prototype-constructor.js
|
| +++ b/test/webkit/fast/js/string-fontsize.js
|
| @@ -22,21 +22,35 @@
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| description(
|
| -'This is a test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=3537">bug 3537</a>.'
|
| +'This is a test case for String.prototype.fontsize(size).'
|
| );
|
|
|
| -var Foo = { Bar: function () {}};
|
| -var f = new Foo.Bar();
|
| -shouldBe("f.constructor", "Foo.Bar");
|
| -shouldBe("typeof f.constructor", '"function"');
|
| -
|
| -function F() {};
|
| -var Foo2 = { Bar: F};
|
| -var f2 = new Foo2.Bar();
|
| -shouldBe("f2.constructor", "Foo2.Bar");
|
| -shouldBe("typeof f2.constructor", '"function"');
|
| -
|
| -var Foo3 = { Bar: new Function("")};
|
| -var f3 = new Foo3.Bar();
|
| -shouldBe("f3.constructor", "Foo3.Bar");
|
| -shouldBe("typeof f3.constructor", '"function"');
|
| +// This test is based on http://mathias.html5.org/tests/javascript/string/.
|
| +
|
| +// Check that the quotation mark is correctly escaped.
|
| +shouldBe("'_'.fontsize('\"')", '"<font size=\\""\\">_</font>"');
|
| +
|
| +// Simple case.
|
| +shouldBe("'_'.fontsize('b')", '"<font size=\\"b\\">_</font>"');
|
| +
|
| +// Does not escape special characters in `this` value.
|
| +shouldBe("'<'.fontsize('b')", '"<font size=\\"b\\"><</font>"');
|
| +
|
| +// First argument gets ToString()ed.
|
| +shouldBe("'_'.fontsize(0x2A)", '"<font size=\\"42\\">_</font>"');
|
| +
|
| +// Check that the quotation mark is correctly escaped.
|
| +shouldBe("'_'.fontsize('\"')", '"<font size=\\""\\">_</font>"');
|
| +shouldBe("'_'.fontsize('\" color=\"b')", '"<font size=\\"" color="b\\">_</font>"');
|
| +
|
| +// Generic use on Number object.
|
| +shouldBe("String.prototype.fontsize.call(0x2A, 0x2A)", '"<font size=\\"42\\">42</font>"');
|
| +
|
| +// Generic use on non-coercible object `undefined`.
|
| +shouldThrow("String.prototype.fontsize.call(undefined)", '"TypeError: Type error"');
|
| +
|
| +// Generic use on non-coercible object `null`.
|
| +shouldThrow("String.prototype.fontsize.call(null)", '"TypeError: Type error"');
|
| +
|
| +// Check fontsize.length.
|
| +shouldBe("String.prototype.fontsize.length", "1");
|
|
|