OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 Apple Computer, Inc. All rights reserved. |
| 2 // |
| 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions |
| 5 // are met: |
| 6 // |
| 7 // 1. Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. |
| 9 // |
| 10 // 2. Redistributions in binary form must reproduce the above |
| 11 // copyright notice, this list of conditions and the following |
| 12 // disclaimer in the documentation and/or other materials provided |
| 13 // with the distribution. |
| 14 // |
| 15 // 3. Neither the name of the copyright holder(s) nor the names of any |
| 16 // contributors may be used to endorse or promote products derived |
| 17 // from this software without specific prior written permission. |
| 18 // |
| 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 22 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 23 // COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 24 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 25 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 26 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 28 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 30 // OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 |
| 32 // Based on LayoutTests/fast/js/resources/Array-isArray.js |
| 33 |
| 34 assertTrue(Array.isArray([])); |
| 35 assertTrue(Array.isArray(new Array)); |
| 36 assertTrue(Array.isArray(Array())); |
| 37 assertTrue(Array.isArray('abc'.match(/(a)*/g))); |
| 38 assertFalse((function(){ return Array.isArray(arguments); })()); |
| 39 assertFalse(Array.isArray()); |
| 40 assertFalse(Array.isArray(null)); |
| 41 assertFalse(Array.isArray(undefined)); |
| 42 assertFalse(Array.isArray(true)); |
| 43 assertFalse(Array.isArray(false)); |
| 44 assertFalse(Array.isArray('a string')); |
| 45 assertFalse(Array.isArray({})); |
| 46 assertFalse(Array.isArray({length: 5})); |
| 47 assertFalse(Array.isArray({__proto__: Array.prototype, length:1, 0:1, 1:2})); |
| 48 |
OLD | NEW |