[KSS-checkins] r50392 - in kukit/kukit.js/branch/ree-service-layer-and-refactoring: . tests

reebalazs at codespeak.net reebalazs at codespeak.net
Sun Jan 6 17:08:10 CET 2008


Author: reebalazs
Date: Sun Jan  6 17:08:09 2008
New Revision: 50392

Modified:
   kukit/kukit.js/branch/ree-service-layer-and-refactoring/   (props changed)
   kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_errors.js
Log:
Make each test that can only run in development mode,
pass green in production mode,
rather then adding the testcase conditionally.

Modified: kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_errors.js
==============================================================================
--- kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_errors.js	(original)
+++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_errors.js	Sun Jan  6 17:08:09 2008
@@ -30,6 +30,10 @@
     this.testCreateGenuineError = function() {
         // Create a genuine error message.
         // An error message of a given type can be created on the fly.
+        //
+        // This test can only run in development mode, pass otherwise.
+        if (! kukit.isDevelMode) {return;}
+        //
         var E = kukit.err.setErrorInfo(null, 'MyError', 'Something went wrong', {a:1, b:2}); 
         // Check that error has the message
         this.assertEquals(E.message, 'MyError: Something went wrong');
@@ -40,7 +44,12 @@
     };
 
     this.testCreateErrorFromTxt = function() {
+        // Create a genuine error message.
         // Create an annotated error from text.
+        //
+        // This test can only run in development mode, pass otherwise.
+        if (! kukit.isDevelMode) {return;}
+        //
         // XXX this works but gives warning: this way we cannot preserve the traceback.
         var orig_txt = "Original error";
         var E = kukit.err.setErrorInfo(orig_txt, 'MyError', 'Something went wrong', {a:1, b:2}); 
@@ -54,7 +63,12 @@
     };
 
     this.testCreateErrorFromRawError = function() {
+        // Create a genuine error message.
         // Create an annotated error from a raw, unannorated error.
+        //
+        // This test can only run in development mode, pass otherwise.
+        if (! kukit.isDevelMode) {return;}
+        //
         var orig_err = new Error("Original error");
         var E = kukit.err.setErrorInfo(orig_err, 'MyError', 'Something went wrong', {a:1, b:2}); 
         // Check that error has the message
@@ -67,9 +81,14 @@
     };
 
     this.testCreateErrorFromAnnotatedError = function() {
+        // Create a genuine error message.
         // Create an error from an annotated error message.
         // this message is a genuine error created by us
         // create chain of errors
+        //
+        // This test can only run in development mode, pass otherwise.
+        if (! kukit.isDevelMode) {return;}
+        //
         var orig_err = kukit.err.setErrorInfo(null, 'MyError', 'Something went wrong', {a:1, b:2}); 
         var E = kukit.err.setErrorInfo(orig_err, 'YourError', 'Wrong here too', {a:2, b:3}); 
         // Check that error has the message
@@ -82,9 +101,14 @@
     };
 
     this.testCreateErrorFromAnnotatedError2 = function() {
+        // Create a genuine error message.
         // Create an error from an annotated error message.
         // this message is a string error
         // create chain of errors
+        //
+        // This test can only run in development mode, pass otherwise.
+        if (! kukit.isDevelMode) {return;}
+        //
         var orig_txt = "Original error";
         var err1 = kukit.err.setErrorInfo(orig_txt, 'MyError', 'Something went wrong', {a:1, b:2}); 
         var E = kukit.err.setErrorInfo(err1, 'YourError', 'Wrong here too', {a:2, b:3}); 
@@ -99,9 +123,14 @@
     };
 
     this.testCreateErrorFromAnnotatedError3 = function() {
+        // Create a genuine error message.
         // Create an error from an annotated error message.
         // This message is an unannotated error object
         // create chain of errors
+        //
+        // This test can only run in development mode, pass otherwise.
+        if (! kukit.isDevelMode) {return;}
+        //
         var orig_err = new Error("Original error");
         var err1 = kukit.err.setErrorInfo(orig_err, 'MyError', 'Something went wrong', {a:1, b:2}); 
         var E = kukit.err.setErrorInfo(err1, 'YourError', 'Wrong here too', {a:2, b:3}); 
@@ -116,8 +145,13 @@
     };
 
     this.testCreateErrorManyLevels = function() {
+        // Create a genuine error message.
         // Many levels together
         // create chain of errors
+        //
+        // This test can only run in development mode, pass otherwise.
+        if (! kukit.isDevelMode) {return;}
+        //
         var orig_err = new Error("Original error");
         var err1 = kukit.err.setErrorInfo(orig_err, 'Error1', 'Wrong 1', {a:1, b:2}); 
         var err2 = kukit.err.setErrorInfo(err1, 'Error2', 'Wrong 2', {a:2, b:3}); 
@@ -138,18 +172,10 @@
         this.assertDictEquals(E.info.kw, {a:5, b:6});
     };
 
-
-
-
-
 };
     
 kukit.ErrorsTestCase.prototype = new kukit.UtilsTestCaseBase;
 
 if (typeof(testcase_registry) != 'undefined') {
-    // Only add these tests for development mode
-    // (For the console, they are added elsewhere permanently.)
-    if (kukit.isDevelMode) {
-        testcase_registry.registerTestCase(kukit.ErrorsTestCase, 'kukit.ErrorsTestCase');
-    }
+    testcase_registry.registerTestCase(kukit.ErrorsTestCase, 'kukit.ErrorsTestCase');
 }


More information about the Kukit-checkins mailing list