OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Array.prototype.map, | 144 Array.prototype.map, |
145 Array.prototype.filter]; | 145 Array.prototype.filter]; |
146 | 146 |
147 // Reduce functions. | 147 // Reduce functions. |
148 var reducing_functions = | 148 var reducing_functions = |
149 [Array.prototype.reduce, | 149 [Array.prototype.reduce, |
150 Array.prototype.reduceRight]; | 150 Array.prototype.reduceRight]; |
151 | 151 |
152 function checkExpectedMessage(e) { | 152 function checkExpectedMessage(e) { |
153 assertTrue(e.message.indexOf("called on null or undefined") >= 0 || | 153 assertTrue(e.message.indexOf("called on null or undefined") >= 0 || |
| 154 e.message.indexOf("invoked on undefined or null value") >= 0 || |
154 e.message.indexOf("Cannot convert null to object") >= 0); | 155 e.message.indexOf("Cannot convert null to object") >= 0); |
155 } | 156 } |
156 | 157 |
157 // Test that all natives using the ToObject call throw the right exception. | 158 // Test that all natives using the ToObject call throw the right exception. |
158 for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) { | 159 for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) { |
159 // Sanity check that all functions are correct | 160 // Sanity check that all functions are correct |
160 assertEquals(typeof(should_throw_on_null_and_undefined[i]), "function"); | 161 assertEquals(typeof(should_throw_on_null_and_undefined[i]), "function"); |
161 | 162 |
162 var exception = false; | 163 var exception = false; |
163 try { | 164 try { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 347 } |
347 } | 348 } |
348 | 349 |
349 | 350 |
350 // Object.prototype.toString() | 351 // Object.prototype.toString() |
351 assertEquals(Object.prototype.toString.call(null), | 352 assertEquals(Object.prototype.toString.call(null), |
352 '[object Null]') | 353 '[object Null]') |
353 | 354 |
354 assertEquals(Object.prototype.toString.call(undefined), | 355 assertEquals(Object.prototype.toString.call(undefined), |
355 '[object Undefined]') | 356 '[object Undefined]') |
OLD | NEW |