Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for no operator group
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent 4bbf88e commit b0a6960
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/bq-translator.js
Expand Up @@ -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 "";
Expand Down
4 changes: 4 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -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'",
Expand Down

0 comments on commit b0a6960

Please sign in to comment.