[Groonga-commit] groonga/gcs [master] bq: throw exception for no min and max range

Back to archive index

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


Kouhei Sutou	2012-08-06 14:56:45 +0900 (Mon, 06 Aug 2012)

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

  Log:
    bq: throw exception for no min and max range

  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:54:48 +0900 (aea25b1)
+++ lib/bq-translator.js    2012-08-06 14:56:45 +0900 (5542f6f)
@@ -333,8 +333,7 @@ BooleanQueryTranslator.prototype = {
     if (is_range) {
       var expressions = [];
       if (min.length == 0 && max.length == 0) {
-        // TODO: report error: only ".."
-        return "";
+        this.throwTranslateError("both min and max are missing");
       }
       if (min.length > 0) {
         expressions.push(field + " >= " + min);

  Modified: test/bq-translator.test.js (+5 -0)
===================================================================
--- test/bq-translator.test.js    2012-08-06 14:54:48 +0900 (c8048ca)
+++ test/bq-translator.test.js    2012-08-06 14:56:45 +0900 (3dc0886)
@@ -293,4 +293,9 @@ suite('BoolanQueryTranslator', function() {
                       "'\"keyword",
                       "'\"keyword||",
                       "close double quote for phrase is missing");
+
+  testExpressionError("value only: unsigned integer range: no min and max",
+                      "..",
+                      "..||",
+                      "both min and max are missing");
 });
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



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