Author: reebalazs
Date: Sun Jan  6 17:08:13 2008
New Revision: 50393

Modified:
   kukit/kukit.js/branch/ree-service-layer-and-refactoring/   (props changed)
   
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_tokenizer.js
Log:
Fix the ecma test testException itself, to run on IE
All ecma is green on IE6, and Safari 3.0.3

Modified: 
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_tokenizer.js
==============================================================================
--- 
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_tokenizer.js 
    (original)
+++ 
kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_tokenizer.js 
    Sun Jan  6 17:08:13 2008
@@ -105,26 +105,19 @@
         } catch(e) {
             exc = e;
         }
+        // It is pointless to test for exc.toString(), first IE returns the 
constant
+        // '[object Error]' in some versions, then it is not really important
+        // for us since we use our own annotation info anyway.
         this.assertNotEquals(exc, null);
         this.assertEquals(exc.name, 'ParsingError');
-        // test here under tries to discriminate IE
-        // it does work for IE 6.0.2900.2180.xpsp_sp2
-        // it does not work at least for IE 6.0.2800.1106
-        if (typeof(exc.number) == 'number') {
-            // IE
-            this.assertEquals(exc.description, 'ParsingError: Error happened');
-            this.assertEquals(exc.info.message, 'Error happened');
-        } else {
-            // toString result is browser dependent.
-            // colon in FF
-            // dash in Safari
-            // reason for the indexOf below
-            var toString = exc.toString();
-            this.assertTrue(toString.indexOf('ParsingError') != -1, 
'"ParsingError" not in toString() : ' + toString);
-            this.assertTrue(toString.indexOf('Error happened') != -1, '"Error 
happened" not in toString() : ' + toString);
-            this.assertEquals(exc.message, 'ParsingError: Error happened');
-            this.assertEquals(exc.info.message, 'Error happened');
-        };
+        // exc.description is needed for IE, 
+        // ... exc.message is for all W3C compliant browsers.
+        this.assert(exc.message =='ParsingError: Error happened' ||
+                    exc.description == 'ParsingError: Error happened');
+        // Most important is to have the annotation info,
+        // since we use this for logging and testing:
+        this.assertEquals(exc.info.message, 'Error happened');
+        // check positions
         this.assertEquals(exc.errpos, null);
         this.assertEquals(exc.errrow, null);
         this.assertEquals(exc.errcol, null);
@@ -143,24 +136,19 @@
         }
         this.assertNotEquals(exc, null);
         this.assertEquals(exc.name, 'ParsingError');
-        // test here under tries to discriminate IE
-        // it does work for IE 6.0.2900.2180.xpsp_sp2
-        // it does not work at least for IE 6.0.2800.1106
-        if (typeof(exc.number) == 'number') {
-            // IE
-            this.assertEquals(exc.description, 'ParsingError: Error happened, 
at row 3, column 4');
-            this.assertEquals(exc.info.message, 'Error happened, at row 3, 
column 4');
-        } else {
-            // toString result is browser dependent.
-            // colon in FF
-            // dash in Safari
-            // reason for the indexOf below
-            var toString = exc.toString();
-            this.assertTrue(toString.indexOf('ParsingError') != -1, 
'"ParsingError" not in toString() : ' + toString);
-            this.assertTrue(toString.indexOf('Error happened, at row 3, column 
4') != -1, '"Error happened, at row 3, column 4" not in toString() : ' + 
toString);
-            this.assertEquals(exc.message, 'ParsingError: Error happened, at 
row 3, column 4');
-            this.assertEquals(exc.info.message, 'Error happened, at row 3, 
column 4');
-        };
+        // It is pointless to test for exc.toString(), first IE returns the 
constant
+        // '[object Error]' in some versions, then it is not really important
+        // for us since we use our own annotation info anyway.
+        this.assertNotEquals(exc, null);
+        this.assertEquals(exc.name, 'ParsingError');
+        // exc.description is needed for IE, 
+        // ... exc.message is for all W3C compliant browsers.
+        this.assert(exc.message == 'ParsingError: Error happened, at row 3, 
column 4' ||
+                    exc.description == 'Error happened');
+        // Most important is to have the annotation info,
+        // since we use this for logging and testing:
+        this.assertEquals(exc.info.message, 'Error happened, at row 3, column 
4');
+        // check positions
         this.assertEquals(exc.info.kw.errpos, 13);
         this.assertEquals(exc.info.kw.errrow, 3);
         this.assertEquals(exc.info.kw.errcol, 4);
_______________________________________________
Kukit-checkins mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kukit-checkins

Reply via email to