// Copyright 2014 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Tests taken from: // http://mathias.html5.org/tests/javascript/string/ assertEquals('_'.anchor('b'), '_'); assertEquals('<'.anchor('<'), '<'); assertEquals('_'.anchor(0x2A), '_'); assertEquals('_'.anchor('\x22'), '_'); assertEquals(String.prototype.anchor.call(0x2A, 0x2A), '42'); assertThrows(function() { String.prototype.anchor.call(undefined); }, TypeError); assertThrows(function() { String.prototype.anchor.call(null); }, TypeError); assertEquals(String.prototype.anchor.length, 1); assertEquals('_'.big(), '_'); assertEquals('<'.big(), '<'); assertEquals(String.prototype.big.call(0x2A), '42'); assertThrows(function() { String.prototype.big.call(undefined); }, TypeError); assertThrows(function() { String.prototype.big.call(null); }, TypeError); assertEquals(String.prototype.big.length, 0); assertEquals('_'.blink(), '_'); assertEquals('<'.blink(), '<'); assertEquals(String.prototype.blink.call(0x2A), '42'); assertThrows(function() { String.prototype.blink.call(undefined); }, TypeError); assertThrows(function() { String.prototype.blink.call(null); }, TypeError); assertEquals(String.prototype.blink.length, 0); assertEquals('_'.bold(), '_'); assertEquals('<'.bold(), '<'); assertEquals(String.prototype.bold.call(0x2A), '42'); assertThrows(function() { String.prototype.bold.call(undefined); }, TypeError); assertThrows(function() { String.prototype.bold.call(null); }, TypeError); assertEquals(String.prototype.bold.length, 0); assertEquals('_'.fixed(), '_'); assertEquals('<'.fixed(), '<'); assertEquals(String.prototype.fixed.call(0x2A), '42'); assertThrows(function() { String.prototype.fixed.call(undefined); }, TypeError); assertThrows(function() { String.prototype.fixed.call(null); }, TypeError); assertEquals(String.prototype.fixed.length, 0); assertEquals('_'.fontcolor('b'), '_'); assertEquals('<'.fontcolor('<'), '<'); assertEquals('_'.fontcolor(0x2A), '_'); assertEquals('_'.fontcolor('\x22'), '_'); assertEquals(String.prototype.fontcolor.call(0x2A, 0x2A), '42'); assertThrows(function() { String.prototype.fontcolor.call(undefined); }, TypeError); assertThrows(function() { String.prototype.fontcolor.call(null); }, TypeError); assertEquals(String.prototype.fontcolor.length, 1); assertEquals('_'.fontsize('b'), '_'); assertEquals('<'.fontsize('<'), '<'); assertEquals('_'.fontsize(0x2A), '_'); assertEquals('_'.fontsize('\x22'), '_'); assertEquals(String.prototype.fontsize.call(0x2A, 0x2A), '42'); assertThrows(function() { String.prototype.fontsize.call(undefined); }, TypeError); assertThrows(function() { String.prototype.fontsize.call(null); }, TypeError); assertEquals(String.prototype.fontsize.length, 1); assertEquals('_'.italics(), '_'); assertEquals('<'.italics(), '<'); assertEquals(String.prototype.italics.call(0x2A), '42'); assertThrows(function() { String.prototype.italics.call(undefined); }, TypeError); assertThrows(function() { String.prototype.italics.call(null); }, TypeError); assertEquals(String.prototype.italics.length, 0); assertEquals('_'.link('b'), '_'); assertEquals('<'.link('<'), '<'); assertEquals('_'.link(0x2A), '_'); assertEquals('_'.link('\x22'), '_'); assertEquals(String.prototype.link.call(0x2A, 0x2A), '42'); assertThrows(function() { String.prototype.link.call(undefined); }, TypeError); assertThrows(function() { String.prototype.link.call(null); }, TypeError); assertEquals(String.prototype.link.length, 1); assertEquals('_'.small(), '_'); assertEquals('<'.small(), '<'); assertEquals(String.prototype.small.call(0x2A), '42'); assertThrows(function() { String.prototype.small.call(undefined); }, TypeError); assertThrows(function() { String.prototype.small.call(null); }, TypeError); assertEquals(String.prototype.small.length, 0); assertEquals('_'.strike(), '_'); assertEquals('<'.strike(), '<'); assertEquals(String.prototype.strike.call(0x2A), '42'); assertThrows(function() { String.prototype.strike.call(undefined); }, TypeError); assertThrows(function() { String.prototype.strike.call(null); }, TypeError); assertEquals(String.prototype.strike.length, 0); assertEquals('_'.sub(), '_'); assertEquals('<'.sub(), '<'); assertEquals(String.prototype.sub.call(0x2A), '42'); assertThrows(function() { String.prototype.sub.call(undefined); }, TypeError); assertThrows(function() { String.prototype.sub.call(null); }, TypeError); assertEquals(String.prototype.sub.length, 0); assertEquals('_'.sup(), '_'); assertEquals('<'.sup(), '<'); assertEquals(String.prototype.sup.call(0x2A), '42'); assertThrows(function() { String.prototype.sup.call(undefined); }, TypeError); assertThrows(function() { String.prototype.sup.call(null); }, TypeError); assertEquals(String.prototype.sup.length, 0);