19f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// Copyright 2013 the V8 project authors. All rights reserved. 29f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// Redistribution and use in source and binary forms, with or without 39f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// modification, are permitted provided that the following conditions are 49f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// met: 59f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// 69f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// * Redistributions of source code must retain the above copyright 79f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// notice, this list of conditions and the following disclaimer. 89f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// * Redistributions in binary form must reproduce the above 99f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// copyright notice, this list of conditions and the following 109f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// disclaimer in the documentation and/or other materials provided 119f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// with the distribution. 129f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// * Neither the name of Google Inc. nor the names of its 139f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// contributors may be used to endorse or promote products derived 149f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// from this software without specific prior written permission. 159f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// 169f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 199f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 209f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 219f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 229f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 239f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 249f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 259f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 269f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 279f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org 289f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.orgfunction veryLongString() { 299f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org return "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + 309f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "Nam vulputate metus est. Maecenas quis pellentesque eros," + 319f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "ac mattis augue. Nam porta purus vitae tincidunt blandit." + 329f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "Aliquam lacus dui, blandit id consectetur id, hendrerit ut" + 339f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "felis. Class aptent taciti sociosqu ad litora torquent per" + 349f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "conubia nostra, per inceptos himenaeos. Ut posuere eros et" + 359f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "tempus luctus. Nullam condimentum aliquam odio, at dignissim" + 369f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "augue tincidunt in. Nam mattis vitae mauris eget dictum." + 379f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org "Nam accumsan dignissim turpis a turpis duis."; 389f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org} 399f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org 403c3c8d733702cb2b41471efa5eead1faf5b5711bmachenbach@chromium.orgassertTrue(veryLongString().length > 256); 419f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org 423c3c8d733702cb2b41471efa5eead1faf5b5711bmachenbach@chromium.orgvar re = /...<omitted>.../; 439f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org 449f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.orgtry { 453c3c8d733702cb2b41471efa5eead1faf5b5711bmachenbach@chromium.org Number.prototype.toFixed.call(veryLongString); 469f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org} catch (e) { 473c3c8d733702cb2b41471efa5eead1faf5b5711bmachenbach@chromium.org assertTrue(e.message.length < 256); 483c3c8d733702cb2b41471efa5eead1faf5b5711bmachenbach@chromium.org assertTrue(re.test(e.message)); 499f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org} 509f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org 519f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.orgtry { 529f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org throw Error(veryLongString()); 539f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org} catch (e) { 549f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org assertEquals(veryLongString(), e.message); 559f18d9111f676f2899d9aa2444130c985eb75395machenbach@chromium.org} 56