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

Side by Side Diff: test/mjsunit/es6/string-html.js

Issue 1194173004: Fix string HTML methods to call ToString (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Tests taken from: 5 // Tests taken from:
6 // http://mathias.html5.org/tests/javascript/string/ 6 // http://mathias.html5.org/tests/javascript/string/
7 7
8 assertEquals('_'.anchor('b'), '<a name="b">_</a>'); 8 assertEquals('_'.anchor('b'), '<a name="b">_</a>');
9 assertEquals('<'.anchor('<'), '<a name="<"><</a>'); 9 assertEquals('<'.anchor('<'), '<a name="<"><</a>');
10 assertEquals('_'.anchor(0x2A), '<a name="42">_</a>'); 10 assertEquals('_'.anchor(0x2A), '<a name="42">_</a>');
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 assertEquals('_'.sup(), '<sup>_</sup>'); 150 assertEquals('_'.sup(), '<sup>_</sup>');
151 assertEquals('<'.sup(), '<sup><</sup>'); 151 assertEquals('<'.sup(), '<sup><</sup>');
152 assertEquals(String.prototype.sup.call(0x2A), '<sup>42</sup>'); 152 assertEquals(String.prototype.sup.call(0x2A), '<sup>42</sup>');
153 assertThrows(function() { 153 assertThrows(function() {
154 String.prototype.sup.call(undefined); 154 String.prototype.sup.call(undefined);
155 }, TypeError); 155 }, TypeError);
156 assertThrows(function() { 156 assertThrows(function() {
157 String.prototype.sup.call(null); 157 String.prototype.sup.call(null);
158 }, TypeError); 158 }, TypeError);
159 assertEquals(String.prototype.sup.length, 0); 159 assertEquals(String.prototype.sup.length, 0);
160
161
162 (function TestToString() {
163 var calls = 0;
164 var obj = {
165 toString() {
166 calls++;
167 return 'abc';
168 },
169 valueOf() {
170 assertUnreachable();
171 }
172 };
173
174 var methodNames = [
175 'anchor',
176 'big',
177 'blink',
178 'bold',
179 'fixed',
180 'fontcolor',
181 'fontsize',
182 'italics',
183 'link',
184 'small',
185 'strike',
186 'sub',
187 'sup',
188 ];
189 for (var name of methodNames) {
190 calls = 0;
191 String.prototype[name].call(obj);
192 assertEquals(1, calls);
193 }
194 })();
OLDNEW
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698