Navigation Menu

Skip to content

Commit

Permalink
bq: throw exception for invalid field name character
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Aug 6, 2012
1 parent 6f0047f commit 7a21371
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bq-translator.js
Expand Up @@ -132,8 +132,8 @@ BooleanQueryTranslator.prototype = {
"field:<" + field + ">");
}
} else {
// TODO: report error: invalid field character
return "";
this.throwTranslateError("invalid field character: " +
"<" + character + ">");
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/bq-translator.test.js
Expand Up @@ -159,6 +159,10 @@ suite('BoolanQueryTranslator', function() {
"(field f1)",
"(field f1|)|",
"field value is missing: field:<f1>");
testGroupError("field: invalid field name",
"(field fIeld 'value')",
"(field f|I|eld 'value')",
"invalid field character: <I>");

testExpression("value only: stirng: and: space",
"'keyword1 keyword2' 'other keyword'",
Expand Down

0 comments on commit 7a21371

Please sign in to comment.