lib: unit tests: improve / better coverage

This commit is contained in:
Dirk-Jan C. Binnema
2023-09-13 23:02:53 +03:00
parent 7c16d080d2
commit 9dcbe1d96c
15 changed files with 304 additions and 147 deletions

View File

@ -264,14 +264,12 @@ parse_basic(const Field &field, Sexp &&vals, Mu::ParserFlags flags)
if (auto&& finfo{flag_info(val)}; finfo)
return Xapian::Query{field.xapian_term(finfo->shortcut_lower())};
else
return Err(Error::Code::InvalidArgument,
"invalid flag '{}'", val);
return Err(Error::Code::InvalidArgument, "invalid flag '{}'", val);
case Field::Id::Priority:
if (auto&& prio{priority_from_name(val)}; prio)
return Xapian::Query{field.xapian_term(to_char(*prio))};
else
return Err(Error::Code::InvalidArgument,
"invalid priority '{}'", val);
return Err(Error::Code::InvalidArgument, "invalid priority '{}'", val);
default: {
auto q{Xapian::Query{field.xapian_term(val)}};
if (ngrams) { // special case: cjk; see if we can create an expanded query.
@ -328,8 +326,7 @@ parse(const Store& store, Sexp&& s, Mu::ParserFlags flags)
return parse_field_matcher(store, *field,
*match_sym, std::move(*args));
}
return Err(Error::Code::InvalidArgument,
"unexpected sexp {}", s.to_string());
return Err(Error::Code::InvalidArgument, "unexpected sexp {}", s.to_string());
}
/* LCOV_EXCL_START */