null+****@clear*****
null+****@clear*****
2012年 8月 6日 (月) 13:59:36 JST
Kouhei Sutou 2012-08-06 13:59:36 +0900 (Mon, 06 Aug 2012) New Revision: 1f41ec354c8a5b79f984346f0126741fb6ff2afe https://github.com/groonga/gcs/commit/1f41ec354c8a5b79f984346f0126741fb6ff2afe Log: bq: throw exception for missing close parenthesis for filter Modified files: lib/bq-translator.js test/bq-translator.test.js Modified: lib/bq-translator.js (+3 -4) =================================================================== --- lib/bq-translator.js 2012-08-06 13:57:23 +0900 (1987abd) +++ lib/bq-translator.js 2012-08-06 13:59:36 +0900 (3e6cf51) @@ -159,13 +159,12 @@ BooleanQueryTranslator.prototype = { "field:<" + field + ">"); } } else { - // TODO: report error: invalid field character - return ""; + this.throwTranslateError("invalid field character: " + + "<" + character + ">"); } } - // TODO: report error: missing close paren <)> - return ""; + this.throwTranslateError("close parenthesis is missing: operator:<filter>"); }, translateGroupSetOperation: function(setOperator) { var expressions = []; Modified: test/bq-translator.test.js (+8 -0) =================================================================== --- test/bq-translator.test.js 2012-08-06 13:57:23 +0900 (428edc5) +++ test/bq-translator.test.js 2012-08-06 13:59:36 +0900 (fbe48d3) @@ -176,6 +176,14 @@ suite('BoolanQueryTranslator', function() { "(filter f1)", "(filter f1|)|", "field value is missing: field:<f1>"); + testGroupError("filter: invalid field name", + "(filter fIeld 'value')", + "(filter f|I|eld 'value')", + "invalid field character: <I>"); + testGroupError("filter: missing close parenthesis", + "(filter ", + "(filter ||", + "close parenthesis is missing: operator:<filter>"); // testGroupError("and: missing close parentheis", // "(and f1:'k1' f2:'k2'", -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B... Download