Ticket #515: xapian_ticket_515_test.patch

File xapian_ticket_515_test.patch, 855 bytes (added by Richard Boulton, 14 years ago)

Patch with testcase reproducing this problem

  • queryparsertest.cc

     
    22932293#endif
    22942294}
    22952295
     2296// Regression test for a bug reported in 1.2.3 with default_op of AND_MAYBE
     2297static bool test_qp_and_maybe_near()
     2298{
     2299    Xapian::QueryParser qp;
     2300    qp.set_default_op(Xapian::Query::OP_AND_MAYBE);
     2301    // 1.2.3 segfaults when parsing the following query.
     2302    TEST_EXCEPTION(Xapian::InvalidArgumentError,
     2303                   qp.parse_query("a-b NEAR c NEAR d"));
     2304    return true;
     2305}
     2306
    22962307/// Test cases for the QueryParser.
    22972308static const test_desc tests[] = {
    22982309    TESTCASE(queryparser1),
     
    23282339    TESTCASE(qp_scale1),
    23292340    TESTCASE(qp_near1),
    23302341    TESTCASE(qp_stopword_group1),
     2342    TESTCASE(qp_and_maybe_near),
    23312343    END_OF_TESTCASES
    23322344};
    23332345