Home | History | Annotate | Download | only in mjsunit
      1 // Copyright 2008 the V8 project authors. All rights reserved.
      2 // Redistribution and use in source and binary forms, with or without
      3 // modification, are permitted provided that the following conditions are
      4 // met:
      5 //
      6 //     * Redistributions of source code must retain the above copyright
      7 //       notice, this list of conditions and the following disclaimer.
      8 //     * Redistributions in binary form must reproduce the above
      9 //       copyright notice, this list of conditions and the following
     10 //       disclaimer in the documentation and/or other materials provided
     11 //       with the distribution.
     12 //     * Neither the name of Google Inc. nor the names of its
     13 //       contributors may be used to endorse or promote products derived
     14 //       from this software without specific prior written permission.
     15 //
     16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 
     28 /**
     29  * @fileoverview Assert we match ES3 and Safari.
     30  */
     31 
     32 assertEquals(0, Array.prototype.length, "Array.prototype.length");
     33 assertEquals(1, Array.length, "Array.length");
     34 assertEquals(1, Array.prototype.concat.length, "Array.prototype.concat.length");
     35 assertEquals(1, Array.prototype.join.length, "Array.prototype.join.length");
     36 assertEquals(1, Array.prototype.push.length, "Array.prototype.push.length");
     37 assertEquals(1, Array.prototype.unshift.length, "Array.prototype.unshift.length");
     38 assertEquals(1, Boolean.length, "Boolean.length");
     39 assertEquals(1, Error.length, "Error.length");
     40 assertEquals(1, EvalError.length, "EvalError.length");
     41 assertEquals(1, Function.length, "Function.length");
     42 assertEquals(1, Function.prototype.call.length, "Function.prototype.call.length");
     43 assertEquals(1, Number.length, "Number.length");
     44 assertEquals(1, Number.prototype.toExponential.length, "Number.prototype.toExponential.length");
     45 assertEquals(1, Number.prototype.toFixed.length, "Number.prototype.toFixed.length");
     46 assertEquals(1, Number.prototype.toPrecision.length, "Number.prototype.toPrecision.length");
     47 assertEquals(1, Object.length, "Object.length");
     48 assertEquals(1, RangeError.length, "RangeError.length");
     49 assertEquals(1, ReferenceError.length, "ReferenceError.length");
     50 assertEquals(1, String.fromCharCode.length, "String.fromCharCode.length");
     51 assertEquals(1, String.length, "String.length");
     52 assertEquals(1, String.prototype.concat.length, "String.prototype.concat.length");
     53 assertEquals(1, String.prototype.indexOf.length, "String.prototype.indexOf.length");
     54 assertEquals(1, String.prototype.lastIndexOf.length, "String.prototype.lastIndexOf.length");
     55 assertEquals(1, SyntaxError.length, "SyntaxError.length");
     56 assertEquals(1, TypeError.length, "TypeError.length");
     57 assertEquals(2, Array.prototype.slice.length, "Array.prototype.slice.length");
     58 assertEquals(2, Array.prototype.splice.length, "Array.prototype.splice.length");
     59 assertEquals(2, Date.prototype.setMonth.length, "Date.prototype.setMonth.length");
     60 assertEquals(2, Date.prototype.setSeconds.length, "Date.prototype.setSeconds.length");
     61 assertEquals(2, Date.prototype.setUTCMonth.length, "Date.prototype.setUTCMonth.length");
     62 assertEquals(2, Date.prototype.setUTCSeconds.length, "Date.prototype.setUTCSeconds.length");
     63 assertEquals(2, Function.prototype.apply.length, "Function.prototype.apply.length");
     64 assertEquals(2, Math.max.length, "Math.max.length");
     65 assertEquals(2, Math.min.length, "Math.min.length");
     66 assertEquals(2, RegExp.length, "RegExp.length");
     67 assertEquals(2, String.prototype.slice.length, "String.prototype.slice.length");
     68 assertEquals(2, String.prototype.split.length, "String.prototype.split.length");
     69 assertEquals(2, String.prototype.substr.length, "String.prototype.substr.length");
     70 assertEquals(2, String.prototype.substring.length, "String.prototype.substring.length");
     71 assertEquals(3, Date.prototype.setFullYear.length, "Date.prototype.setFullYear.length");
     72 assertEquals(3, Date.prototype.setMinutes.length, "Date.prototype.setMinutes.length");
     73 assertEquals(3, Date.prototype.setUTCFullYear.length, "Date.prototype.setUTCFullYear.length");
     74 assertEquals(3, Date.prototype.setUTCMinutes.length, "Date.prototype.setUTCMinutes.length");
     75 assertEquals(4, Date.prototype.setHours.length, "Date.prototype.setHours.length");
     76 assertEquals(4, Date.prototype.setUTCHours.length, "Date.prototype.setUTCHours.length");
     77 assertEquals(7, Date.UTC.length, "Date.UTC.length");
     78 assertEquals(7, Date.length, "Date.length");
     79