Author: reebalazs Date: Fri Dec 28 12:41:30 2007 New Revision: 50151 Modified: kukit/kukit.js/branch/ree-service-layer-and-refactoring/ (props changed) kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/errors.js kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/kssparser.js kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_kssparser.js Log: Fix handling of value provider error during parsing, provide a test that unknown value provider causes error identify an error (Unexpected EOF if there are more parameters of the provider in the binder id identification) provide a test for it.
Modified: kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/errors.js ============================================================================== --- kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/errors.js (original) +++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/errors.js Fri Dec 28 12:41:30 2007 @@ -148,6 +148,17 @@ ;;; }; +/* + * Exceptions that re-throw (annotate) an already thrown error + * + * These have purpose of adding some more generic explanation to the + * error, as well as adding more information. + * They only should get active in development mode. + * + * e.g. a ParsingError will become, after re-throwing: + * "Error parsing Kss at http://blah [ParsingError: ...]" + */ + // this is raised by the parser in case of errors // it contains row/column information ;;; err.parsingError = function(message, cursor, err){ @@ -165,18 +176,6 @@ ;;; return setErrorInfo(err, 'ParsingError', message, kw); ;;; }; - -/* - * Exceptions that re-throw (annotate) an already thrown error - * - * These have purpose of adding some more generic explanation to the - * error, as well as adding more information. - * They only should get active in development mode. - * - * e.g. a ParsingError will become, after re-throwing: - * "Error parsing Kss at http://blah [ParsingError: ...]" - */ - ;;; err.commandExecutionError = function(e, command){ ;;; var message = 'Command [' + command.name + '] failed'; ;;; return setErrorInfo(e, 'CommandExecutionError', message); @@ -206,11 +205,6 @@ ;;; return setErrorInfo(e, 'EventSetupError', message); ;;; }; -;;; err.valueProviderError = function(e, message){ -;;; return setErrorInfo(e, 'ValueProviderError', message); -;;; }; - - // any error that happens because the required information // cannot be found in the plugin err.pluginRegistryError = function(err, message) { Modified: kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/kssparser.js ============================================================================== --- kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/kssparser.js (original) +++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/kukit/kssparser.js Fri Dec 28 12:41:30 2007 @@ -295,7 +295,7 @@ value.check(iface); ;;; } catch(e) { ;;; kukit.E = 'Error in value provider for parameter [' + key + '].'; -;;; throw kukit.err.valueProviderError(e, kukit.E); +;;; this.emitWrappedError(e, kukit.E); ;;; } action.parms[key] = value; } Modified: kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_kssparser.js ============================================================================== --- kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_kssparser.js (original) +++ kukit/kukit.js/branch/ree-service-layer-and-refactoring/tests/test_kssparser.js Fri Dec 28 12:41:30 2007 @@ -268,7 +268,7 @@ this.assertParsingError(kukit.kssp.PropValue, cursor, null, true, 'Wrong value : unallowed characters after the property.', 17); }; - + this.testEventValueSimple = function() { // Parsing event value var txt= "b"; @@ -806,6 +806,18 @@ }; + this.testValueProviderUnregistered = function() { + // An unregistered value provider + var txt= "" + +"div#update-area:click {\n" + +" action-server: getCurrentTime;\n" + +" getCurrentTime-effect: noSuchProvider(a, b, c); \n" + +"}\n"; + var cursor = new kukit.tk.Cursor(txt); + this.assertParsingError(kukit.kssp.Document, cursor, null, true, + 'Error in value provider for parameter [effect].'); + }; + this.testActionErrorParameters = function() { var txt= "" @@ -1505,6 +1517,21 @@ this.assertParsingError(kukit.kssp.KssSelector, cursor, null, true, 'KssSpecialSelector [behaviour] must not stand with an event id acquired by value provider [kssAttr]'); }; + + this.testValueProvidersInEventIdentificationCanHaveTwoAttributes = function() { + // A value provider can have two attributes. + // Nothing special - it should just work. + var txt= "" + +"div#update-area:click(kssAttr(a, true)) {\n" + +" action-server: getCurrentTime;\n" + +" getCurrentTime-effect: kssAttr; \n" + +"}\n"; + var cursor = new kukit.tk.Cursor(txt); + var parser = new kukit.kssp.Document(cursor, null, true); + this.assertEquals(parser.finished, true); + ///this.assertParsingError(kukit.kssp.Document, cursor, null, true, + // 'Error in value provider for parameter [effect].'); + }; }; _______________________________________________ Kukit-checkins mailing list [email protected] http://codespeak.net/mailman/listinfo/kukit-checkins
