Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for no phrase close quote
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent f024847 commit 864cce6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/bq-translator.js
Expand Up @@ -305,8 +305,7 @@ BooleanQueryTranslator.prototype = {
}
}

// TODO: report error: missing close quote <"'>
return "";
this.throwTranslateError("close double quote for phrase is missing");
},
translateExpressionValueUnsignedInteger: function(field) {
var is_range = false;
Expand Down
5 changes: 5 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -284,8 +284,13 @@ suite('BoolanQueryTranslator', function() {
"'keyword1\\",
"'keyword1\\||",
"escaped character is missing in string value");

testExpressionError("value only: phrase: missing escaped value",
"'\"keyword1\\",
"'\"keyword1\\||",
"escaped character is missing in phrase");
testExpressionError("value only: phrase: missing close quote",
"'\"keyword",
"'\"keyword||",
"close double quote for phrase is missing");
});

0 comments on commit 864cce6

Please sign in to comment.