assert-throws-native.js (774B)
1 // Copyright (C) 2015 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: > 6 Functions that throw instances of the specified native Error constructor 7 satisfy the assertion. 8 ---*/ 9 10 assert.throws(Error, function() { 11 throw new Error(); 12 }); 13 14 assert.throws(EvalError, function() { 15 throw new EvalError(); 16 }); 17 18 assert.throws(RangeError, function() { 19 throw new RangeError(); 20 }); 21 22 assert.throws(ReferenceError, function() { 23 throw new ReferenceError(); 24 }); 25 26 assert.throws(SyntaxError, function() { 27 throw new SyntaxError(); 28 }); 29 30 assert.throws(TypeError, function() { 31 throw new TypeError(); 32 }); 33 34 assert.throws(URIError, function() { 35 throw new URIError(); 36 }); 37 38 reportCompare(0, 0);