From 76cba2f59c7b8d041fa0d84d4ca8974b4de36d80 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Fri, 6 May 2011 11:23:30 +0200 Subject: [PATCH] fix unknown match mode detection --- tests/sat/AttrMatcher_test.cc | 7 +++++++ zypp/sat/AttrMatcher.cc | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/sat/AttrMatcher_test.cc b/tests/sat/AttrMatcher_test.cc index e689f79..98a679c 100644 --- a/tests/sat/AttrMatcher_test.cc +++ b/tests/sat/AttrMatcher_test.cc @@ -76,6 +76,7 @@ BOOST_AUTO_TEST_CASE(Match_operator) BOOST_AUTO_TEST_CASE(AttrMatcher_defaultconstructed) { sat::AttrMatcher m; + BOOST_CHECK_EQUAL( m.flags(), Match::NOTHING ); BOOST_CHECK( !m ); // eval in boolean context BOOST_CHECK( m.searchstring().empty() ); BOOST_CHECK_EQUAL( m.flags(), Match() ); @@ -89,6 +90,12 @@ BOOST_AUTO_TEST_CASE(AttrMatcher_defaultconstructed) BOOST_CHECK( m ); // eval in boolean context } +BOOST_AUTO_TEST_CASE(AttrMatcher_OTHER) +{ + sat::AttrMatcher m( "fau", Match::OTHER ); + BOOST_CHECK_THROW( m.compile(), MatchUnknownModeException ); +} + BOOST_AUTO_TEST_CASE(AttrMatcher_STRING) { sat::AttrMatcher m( "fau" ); diff --git a/zypp/sat/AttrMatcher.cc b/zypp/sat/AttrMatcher.cc index 1a522a7..3646be1 100644 --- a/zypp/sat/AttrMatcher.cc +++ b/zypp/sat/AttrMatcher.cc @@ -186,7 +186,7 @@ namespace zypp { if ( !_matcher ) { - if ( ! _flags.mode() == Match::OTHER ) + if ( _flags.mode() == Match::OTHER ) ZYPP_THROW( MatchUnknownModeException( _flags, _search ) ); _matcher.reset( new ::_Datamatcher ); -- 2.7.4