[Groonga-commit] groonga/gcs [master] bq: throw exception for invalid string value start

Back to archive index

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


Kouhei Sutou	2012-08-06 14:12:10 +0900 (Mon, 06 Aug 2012)

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

  Log:
    bq: throw exception for invalid string value start

  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 14:09:23 +0900 (66e2903)
+++ lib/bq-translator.js    2012-08-06 14:12:10 +0900 (59a6b7c)
@@ -223,8 +223,7 @@ BooleanQueryTranslator.prototype = {
   },
   translateExpressionValueString: function(field) {
     if (this.query[this.offset] != "'") {
-      // TODO: report error
-      return "";
+      this.throwTranslateError("open single quote for string value is missing");
     }
     if (this.query[this.offset + 1] == "\"") {
       return this.translateExpressionValuePhrase(field);

  Modified: test/bq-translator.test.js (+4 -0)
===================================================================
--- test/bq-translator.test.js    2012-08-06 14:09:23 +0900 (5038099)
+++ test/bq-translator.test.js    2012-08-06 14:12:10 +0900 (fdf17e1)
@@ -173,6 +173,10 @@ suite('BoolanQueryTranslator', function() {
                  "(field f1)",
                  "(field f1|)|",
                  "field value is missing: field:<f1>");
+  testGroupError("field: not string value",
+                 "(field f1 29)",
+                 "(field f1 |2|9)",
+                 "open single quote for string value is missing");
   testGroupError("field: invalid field name",
                  "(field fIeld 'value')",
                  "(field f|I|eld 'value')",
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



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