Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
|
Yang
2014/08/05 10:34:19
Since this is not specified until es6, could you m
| |
| 5 assertEquals('_'.anchor('b'), '<a name="b">_</a>'); | |
| 6 //assertEquals('<'.anchor('<'), '<a name="<"><</a>'); // #2217 | |
| 7 assertEquals('_'.anchor(0x2A), '<a name="42">_</a>'); | |
| 8 assertEquals('_'.anchor('\x22'), '<a name=""">_</a>'); | |
| 9 assertEquals(String.prototype.anchor.call(0x2A, 0x2A), '<a name="42">42</a>'); | |
| 10 assertThrows(function() { | |
| 11 String.prototype.anchor.call(undefined); | |
| 12 }, TypeError); | |
| 13 assertThrows(function() { | |
| 14 String.prototype.anchor.call(null); | |
| 15 }, TypeError); | |
| 16 assertEquals(String.prototype.anchor.length, 1); | |
| 17 | |
| 18 assertEquals('_'.big(), '<big>_</big>'); | |
| 19 assertEquals('<'.big(), '<big><</big>'); | |
| 20 assertEquals(String.prototype.big.call(0x2A), '<big>42</big>'); | |
| 21 assertThrows(function() { | |
| 22 String.prototype.big.call(undefined); | |
| 23 }, TypeError); | |
| 24 assertThrows(function() { | |
| 25 String.prototype.big.call(null); | |
| 26 }, TypeError); | |
| 27 assertEquals(String.prototype.big.length, 0); | |
| 28 | |
| 29 assertEquals('_'.blink(), '<blink>_</blink>'); | |
| 30 assertEquals('<'.blink(), '<blink><</blink>'); | |
| 31 assertEquals(String.prototype.blink.call(0x2A), '<blink>42</blink>'); | |
| 32 assertThrows(function() { | |
| 33 String.prototype.blink.call(undefined); | |
| 34 }, TypeError); | |
| 35 assertThrows(function() { | |
| 36 String.prototype.blink.call(null); | |
| 37 }, TypeError); | |
| 38 assertEquals(String.prototype.blink.length, 0); | |
| 39 | |
| 40 assertEquals('_'.bold(), '<b>_</b>'); | |
| 41 assertEquals('<'.bold(), '<b><</b>'); | |
| 42 assertEquals(String.prototype.bold.call(0x2A), '<b>42</b>'); | |
| 43 assertThrows(function() { | |
| 44 String.prototype.bold.call(undefined); | |
| 45 }, TypeError); | |
| 46 assertThrows(function() { | |
| 47 String.prototype.bold.call(null); | |
| 48 }, TypeError); | |
| 49 assertEquals(String.prototype.bold.length, 0); | |
| 50 | |
| 51 assertEquals('_'.fixed(), '<tt>_</tt>'); | |
| 52 assertEquals('<'.fixed(), '<tt><</tt>'); | |
| 53 assertEquals(String.prototype.fixed.call(0x2A), '<tt>42</tt>'); | |
| 54 assertThrows(function() { | |
| 55 String.prototype.fixed.call(undefined); | |
| 56 }, TypeError); | |
| 57 assertThrows(function() { | |
| 58 String.prototype.fixed.call(null); | |
| 59 }, TypeError); | |
| 60 assertEquals(String.prototype.fixed.length, 0); | |
| 61 | |
| 62 assertEquals('_'.fontcolor('b'), '<font color="b">_</font>'); | |
| 63 //assertEquals('<'.fontcolor('<'), '<font color="<"><</font>'); // #2217 | |
| 64 assertEquals('_'.fontcolor(0x2A), '<font color="42">_</font>'); | |
| 65 assertEquals('_'.fontcolor('\x22'), '<font color=""">_</font>'); | |
| 66 assertEquals(String.prototype.fontcolor.call(0x2A, 0x2A), '<font color="42">42</ font>'); | |
|
Yang
2014/08/05 10:34:19
please honor the 80-char limit.
| |
| 67 assertThrows(function() { | |
| 68 String.prototype.fontcolor.call(undefined); | |
| 69 }, TypeError); | |
| 70 assertThrows(function() { | |
| 71 String.prototype.fontcolor.call(null); | |
| 72 }, TypeError); | |
| 73 assertEquals(String.prototype.fontcolor.length, 1); | |
| 74 | |
| 75 assertEquals('_'.fontsize('b'), '<font size="b">_</font>'); | |
| 76 //assertEquals('<'.fontsize('<'), '<font size="<"><</font>'); // #2217 | |
| 77 assertEquals('_'.fontsize(0x2A), '<font size="42">_</font>'); | |
| 78 assertEquals('_'.fontsize('\x22'), '<font size=""">_</font>'); | |
| 79 assertEquals(String.prototype.fontsize.call(0x2A, 0x2A), '<font size="42">42</fo nt>'); | |
| 80 assertThrows(function() { | |
| 81 String.prototype.fontsize.call(undefined); | |
| 82 }, TypeError); | |
| 83 assertThrows(function() { | |
| 84 String.prototype.fontsize.call(null); | |
| 85 }, TypeError); | |
| 86 assertEquals(String.prototype.fontsize.length, 1); | |
| 87 | |
| 88 assertEquals('_'.italics(), '<i>_</i>'); | |
| 89 assertEquals('<'.italics(), '<i><</i>'); | |
| 90 assertEquals(String.prototype.italics.call(0x2A), '<i>42</i>'); | |
| 91 assertThrows(function() { | |
| 92 String.prototype.italics.call(undefined); | |
| 93 }, TypeError); | |
| 94 assertThrows(function() { | |
| 95 String.prototype.italics.call(null); | |
| 96 }, TypeError); | |
| 97 assertEquals(String.prototype.italics.length, 0); | |
| 98 | |
| 99 assertEquals('_'.link('b'), '<a href="b">_</a>'); | |
| 100 //assertEquals('<'.link('<'), '<a href="<"><</a>'); // #2217 | |
| 101 assertEquals('_'.link(0x2A), '<a href="42">_</a>'); | |
| 102 assertEquals('_'.link('\x22'), '<a href=""">_</a>'); | |
| 103 assertEquals(String.prototype.link.call(0x2A, 0x2A), '<a href="42">42</a>'); | |
| 104 assertThrows(function() { | |
| 105 String.prototype.link.call(undefined); | |
| 106 }, TypeError); | |
| 107 assertThrows(function() { | |
| 108 String.prototype.link.call(null); | |
| 109 }, TypeError); | |
| 110 assertEquals(String.prototype.link.length, 1); | |
| 111 | |
| 112 assertEquals('_'.small(), '<small>_</small>'); | |
| 113 assertEquals('<'.small(), '<small><</small>'); | |
| 114 assertEquals(String.prototype.small.call(0x2A), '<small>42</small>'); | |
| 115 assertThrows(function() { | |
| 116 String.prototype.small.call(undefined); | |
| 117 }, TypeError); | |
| 118 assertThrows(function() { | |
| 119 String.prototype.small.call(null); | |
| 120 }, TypeError); | |
| 121 assertEquals(String.prototype.small.length, 0); | |
| 122 | |
| 123 assertEquals('_'.strike(), '<strike>_</strike>'); | |
| 124 assertEquals('<'.strike(), '<strike><</strike>'); | |
| 125 assertEquals(String.prototype.strike.call(0x2A), '<strike>42</strike>'); | |
| 126 assertThrows(function() { | |
| 127 String.prototype.strike.call(undefined); | |
| 128 }, TypeError); | |
| 129 assertThrows(function() { | |
| 130 String.prototype.strike.call(null); | |
| 131 }, TypeError); | |
| 132 assertEquals(String.prototype.strike.length, 0); | |
| 133 | |
| 134 assertEquals('_'.sub(), '<sub>_</sub>'); | |
| 135 assertEquals('<'.sub(), '<sub><</sub>'); | |
| 136 assertEquals(String.prototype.sub.call(0x2A), '<sub>42</sub>'); | |
| 137 assertThrows(function() { | |
| 138 String.prototype.sub.call(undefined); | |
| 139 }, TypeError); | |
| 140 assertThrows(function() { | |
| 141 String.prototype.sub.call(null); | |
| 142 }, TypeError); | |
| 143 assertEquals(String.prototype.sub.length, 0); | |
| 144 | |
| 145 assertEquals('_'.sup(), '<sup>_</sup>'); | |
| 146 assertEquals('<'.sup(), '<sup><</sup>'); | |
| 147 assertEquals(String.prototype.sup.call(0x2A), '<sup>42</sup>'); | |
| 148 assertThrows(function() { | |
| 149 String.prototype.sup.call(undefined); | |
| 150 }, TypeError); | |
| 151 assertThrows(function() { | |
| 152 String.prototype.sup.call(null); | |
| 153 }, TypeError); | |
| 154 assertEquals(String.prototype.sup.length, 0); | |
| OLD | NEW |