throw on invalid filter syntax

This commit is contained in:
Mark Cavage 2012-10-11 20:04:10 +00:00
parent 465d4e662c
commit 51e6abf477
3 changed files with 11 additions and 4 deletions

View File

@ -95,7 +95,6 @@ function perror(err) {
///--- Mainline
log4js.setGlobalLogLevel('INFO');
var parsed;
try {

View File

@ -130,7 +130,8 @@ function _buildFilterTree(expr) {
operatorStr = '=';
tree.tag = 'equalityMatch';
} else {
tree.tag = 'present';
// tree.tag = 'present';
throw new Error('invalid filter syntax');
}
if (operatorStr === '') {

View File

@ -116,10 +116,17 @@ test('GH-53 NotFilter', function (t) {
test('presence filter', function (t) {
var str = '(foo=*)';
var f = parse(str);
var f = parse('(foo=*)');
t.ok(f);
t.equal(f.type, 'present');
t.equal(f.attribute, 'foo');
t.end();
});
test('bogus filter', function (t) {
t.throws(function () {
parse('foo>1');
});
t.end();
});