When expectation fails it produces the following error message:
<cut>
Google Mock tried the following 1 expectation, but it didn't match:
c:\file.cpp:15: EXPECT_CALL(object, Method(0))...
</cut>
Such format is not compatible with MSVC's parser - it cannot find line number
and scrolls the file to the very top.
This string is built in the ExpectationBase::DescribeLocationTo method
(r352, gmock-spec-builders.h @ 577). I suggest to reuse existing function and
change the method from
<code>
void DescribeLocationTo(::std::ostream* os) const {
*os << file() << ":" << line() << ": ";
}
</code>
to
<code>
void DescribeLocationTo(::std::ostream* os) const {
*os << FormatFileLocation(file(), line());
}
</code>
If it leads to some compilation errors, unnecessary dependencies and so on,
this version will also suffice:
<code>
void DescribeLocationTo(::std::ostream* os) const {
#ifdef _MSC_VER
*os << file() << "(" << line() << "): ";
#else
*os << file() << ":" << line() << ": ";
#endif
}
</code>
Original issue reported on code.google.com by yury.mikhaylov on 14 Jan 2011 at 12:54
Original issue reported on code.google.com by
yury.mikhaylov
on 14 Jan 2011 at 12:54