[kupu-checkins] r34312 - kupu/trunk/ecmaunit

duncan at codespeak.net duncan at codespeak.net
Tue Nov 7 12:25:56 CET 2006


Author: duncan
Date: Tue Nov  7 12:25:55 2006
New Revision: 34312

Modified:
   kupu/trunk/ecmaunit/ecmaunit.js
Log:
Make debug method accept multiple arguments.
Decode DOMException codes so that Opera's errors become somewhat less obscure.

Modified: kupu/trunk/ecmaunit/ecmaunit.js
==============================================================================
--- kupu/trunk/ecmaunit/ecmaunit.js	(original)
+++ kupu/trunk/ecmaunit/ecmaunit.js	Tue Nov  7 12:25:55 2006
@@ -72,7 +72,11 @@
 };
 
 TestCase.prototype.debug = function(msg) {
-    this._reporter.debug(msg);
+    var args = [];
+    for (var i=0; i < arguments.length; i++) {
+        args.push(arguments[i]);
+    };
+    this._reporter.debug(args.join(', '));
 }
 TestCase.prototype.assert = function(statement, message) {
     /* assert whether a variable resolves to true */
@@ -171,6 +175,25 @@
                 if (e && e.name && e.message) { // Microsoft
                     e = e.name + ': ' + e.message;
                 }
+                if (e.code && /.*DOMException/i.test(e.toString())) {
+                    var msg = ['', 'INDEX_SIZE_ERR',
+                        'DOMSTRING_SIZE_ERR',
+                        'HIERARCHY_REQUEST_ERR',
+                        'WRONG_DOCUMENT_ERR',
+                        'INVALID_CHARACTER_ERR',
+                        'NO_DATA_ALLOWED_ERR',
+                        'NO_MODIFICATION_ALLOWED_ERR',
+                        'NOT_FOUND_ERR',
+                        'NOT_SUPPORTED_ERR',
+                        'INUSE_ATTRIBUTE_ERR',
+                        'INVALID_STATE_ERR',
+                        'SYNTAX_ERR',
+                        'INVALID_MODIFICATION_ERR',
+                        'NAMESPACE_ERR',
+                        'INVALID_ACCESS_ERR',
+                        ][e.code];
+                    e = "DOMException:" + e.code + ", "+msg;
+                }
                 this._reporter.reportError(this.name, attr, e, raw);
                 this._exceptions.push(new Array(this.name, attr, e, raw));
             };


More information about the kupu-checkins mailing list