Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for invalid string value start
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent 6b55ec3 commit a6fe730
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 @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -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')",
Expand Down

0 comments on commit a6fe730

Please sign in to comment.