Skip to content

Commit

Permalink
Fix EndsWith Matcher (and refactored EndsWith and StartsWith in terms…
Browse files Browse the repository at this point in the history
… of endsWith and startsWith) (see Issue #573)
  • Loading branch information
philsquared committed Jun 6, 2016
1 parent d1b394d commit 51cc268
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/internal/catch_matchers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace Matchers {
virtual ~StartsWith();

virtual bool match( std::string const& expr ) const {
return m_data.adjustString( expr ).find( m_data.m_str ) == 0;
return startsWith( m_data.adjustString( expr ), m_data.m_str );
}
virtual std::string toString() const {
return "starts with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();
Expand All @@ -251,7 +251,7 @@ namespace Matchers {
virtual ~EndsWith();

virtual bool match( std::string const& expr ) const {
return m_data.adjustString( expr ).find( m_data.m_str ) == expr.size() - m_data.m_str.size();
return endsWith( m_data.adjustString( expr ), m_data.m_str );
}
virtual std::string toString() const {
return "ends with: \"" + m_data.m_str + "\"" + m_data.toStringSuffix();
Expand Down

0 comments on commit 51cc268

Please sign in to comment.