| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
If the argument "message" is not undefined, the message property of the newly constructed object is |
| 7 |
set to ToString(message) |
| 8 |
es5id: 15.11.1.1_A1_T1 |
| 9 |
description: Checking message property of different error objects |
| 10 |
---*/ |
| 11 |
|
| 12 |
function otherScope(msg) |
| 13 |
{ |
| 14 |
return Error(msg); |
| 15 |
} |
| 16 |
|
| 17 |
////////////////////////////////////////////////////////////////////////////// |
| 18 |
//CHECK#1 |
| 19 |
var err1 = Error('msg1'); |
| 20 |
if (err1.message !== "msg1") { |
| 21 |
$ERROR('#1: var err1=Error(\'msg1\'); err1.message==="msg1". Actual: ' + err1.message); |
| 22 |
} |
| 23 |
// |
| 24 |
////////////////////////////////////////////////////////////////////////////// |
| 25 |
|
| 26 |
////////////////////////////////////////////////////////////////////////////// |
| 27 |
//CHECK#2 |
| 28 |
var err2 = otherScope('msg2'); |
| 29 |
if (err2.message !== "msg2") { |
| 30 |
$ERROR('#2: function otherScope(msg){return Error(msg);} var err2=otherScope(\'msg2\'); err2.message==="msg2". Actual: ' + err2.message); |
| 31 |
} |
| 32 |
// |
| 33 |
////////////////////////////////////////////////////////////////////////////// |
| 34 |
|
| 35 |
////////////////////////////////////////////////////////////////////////////// |
| 36 |
//CHECK#3 |
| 37 |
var err3 = otherScope(); |
| 38 |
if (err3.hasOwnProperty('message')) { |
| 39 |
$ERROR('#3: function otherScope(msg){return Error(msg);} var err3=otherScope(); err3.hasOwnProperty("message"). Actual: ' + err3.message); |
| 40 |
} |
| 41 |
// |
| 42 |
////////////////////////////////////////////////////////////////////////////// |
| 43 |
|
| 44 |
////////////////////////////////////////////////////////////////////////////// |
| 45 |
//CHECK#4 |
| 46 |
var err4 = eval("Error('msg4')"); |
| 47 |
if (err4.message !== "msg4") { |
| 48 |
$ERROR('#4: var err4=eval("Error(\'msg4\')"); err4.message==="msg4". Actual: ' + err4.message); |
| 49 |
} |
| 50 |
// |
| 51 |
////////////////////////////////////////////////////////////////////////////// |