[Groonga-commit] groonga/gcs [master] bq: throw exception for no operator group

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 6日 (月) 13:14:29 JST


Kouhei Sutou	2012-08-06 13:14:29 +0900 (Mon, 06 Aug 2012)

  New Revision: b0a696093c9c330182bbb1dde791da10c183d870
  https://github.com/groonga/gcs/commit/b0a696093c9c330182bbb1dde791da10c183d870

  Log:
    bq: throw exception for no operator group

  Modified files:
    lib/bq-translator.js
    test/bq-translator.test.js

  Modified: lib/bq-translator.js (+1 -2)
===================================================================
--- lib/bq-translator.js    2012-08-06 13:12:44 +0900 (d1d360e)
+++ lib/bq-translator.js    2012-08-06 13:14:29 +0900 (60118d0)
@@ -98,8 +98,7 @@ BooleanQueryTranslator.prototype = {
         this.offset++;
         return expression;
       } else if (character == ")") {
-        // TODO: report error: no arguments for operator
-        return "";
+        this.throwTranslateError("operator is missing");
       } else {
         // TODO: invalid operator
         return "";

  Modified: test/bq-translator.test.js (+4 -0)
===================================================================
--- test/bq-translator.test.js    2012-08-06 13:12:44 +0900 (5ee55dd)
+++ test/bq-translator.test.js    2012-08-06 13:14:29 +0900 (a0f88f0)
@@ -134,6 +134,10 @@ suite('BoolanQueryTranslator', function() {
                  "(and f1:'k1' f2:'k2'",
                  "(and f1:'k1' f2:'k2'||",
                  "close parenthesis is missing");
+  testGroupError("missing operator",
+                 "()",
+                 "(|)|",
+                 "operator is missing");
 
   testExpression("value only: stirng: and: space",
                  "'keyword1 keyword2' 'other keyword'",
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Back to archive index