Update with current status
[gnash.git] / testsuite / actionscript.all / Error.as
blob50abb8e5292fb400a2b27b83eeab01a76bff41a6
1 //
2 // Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 // Test case for Error ActionScript class
22 // compile this test case with Ming makeswf, and then
23 // execute it like this gnash -1 -r 0 -v out.swf
26 rcsid="Error.as";
27 #include "check.as"
29 #if OUTPUT_VERSION > 5
30 check(Error.prototype.hasOwnProperty("name"));
31 check(Error.prototype.hasOwnProperty("toString"));
32 check(Error.prototype.hasOwnProperty("message"));
33 #endif
35 check_equals(typeof(Error.prototype.message), "string");
36 check_equals(typeof(Error.prototype.name), "string");
38 var errorObj = new Error;
40 // test the Error constuctor
41 check_equals (typeof(errorObj), 'object');
43 // test the Error::tostring method
44 check_equals (typeof(errorObj.toString), 'function');
47 e = new Error;
48 check_equals(e.toString(), "Error");
49 check_equals(e.message, "Error");
50 check_equals(e.name, "Error");
52 e = new Error("NameOfError");
53 check_equals(e.toString(), "NameOfError");
54 check_equals(e.name, "Error");
55 check_equals(e.message, "NameOfError");
58 e = new Error(7.8898);
59 check_equals(e.toString(), "7.8898");
60 check_equals(e.name, "Error");
61 check_equals(e.message, "7.8898");
64 // Is there any sense in this?
65 e = new Error(new Color);
66 check_equals(typeof(e.toString()), "object");
67 check_equals(e.toString().toString(), "[object Object]");
68 check_equals(e.name, "Error");
69 check_equals(typeof(e.message), "object");
71 e.name = "ANewName";
72 check_equals(e.name, "ANewName");
73 e.message = "New message";
74 check_equals(e.message, "New message");
76 e = new Error;
77 e.message = "stringo";
78 check_equals(e.message, "stringo");
79 check_equals(e.name, "Error");
82 e = Error("NameOfSecondError");
83 check_equals(typeof(e), "undefined");
85 totals();