|
Boost : |
Subject: Re: [boost] [Test] Problem testing with wstring
From: Jared McIntyre (jmcintyre_at_[hidden])
Date: 2009-08-26 20:12:07
Whoops. In the rush to simplify the example, I hadn't noticed that the
error messages had changed. Here is the error when a wstring is
properly constructed:
/Users/jared/Source/boost_nobak/boost_1_39_0/boost/test/
test_tools.hpp: In member function void
boost::test_tools::print_log_value<T>::operator()(std::ostream&, const
T&) [with T = std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >]:
/Users/jared/Source/boost_nobak/boost_1_39_0/boost/test/test_tools.hpp:
467: instantiated from std::ostream&
boost::test_tools::tt_detail::operator<<(std::ostream&, const
boost::test_tools::tt_detail::print_helper_t<T>&) [with T =
std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >]
/Users/jared/Source/boost_nobak/boost_1_39_0/boost/test/utils/
lazy_ostream.hpp:74: instantiated from std::ostream&
boost::unit_test::lazy_ostream_impl<T>::operator()(std::ostream&)
const [with T = const
boost
::test_tools::tt_detail::print_helper_t<std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > >&]
std_map.cpp:112: instantiated from here
/Users/jared/Source/boost_nobak/boost_1_39_0/boost/test/test_tools.hpp:
326: error: no match for operator<< in ostr << t
/usr/include/c++/4.0.0/bits/ostream.tcc:67: note: candidates are:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(std::basic_ostream<_CharT, _Traits>& (*)
(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:78: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(std::basic_ios<_CharT, _Traits>& (*)
(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:90: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT
= char, _Traits = std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:125: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(long int) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:159: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(long unsigned int) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:102: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(bool) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/ostream:176: note:
std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
_Traits>::operator<<(short int) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/ostream:187: note:
std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
_Traits>::operator<<(short unsigned int) [with _CharT = char, _Traits
= std::char_traits<char>]
/usr/include/c++/4.0.0/ostream:191: note:
std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
_Traits>::operator<<(int) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/ostream:202: note:
std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
_Traits>::operator<<(unsigned int) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:183: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(long long int) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:218: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(long long unsigned int) [with _CharT = char,
_Traits = std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:242: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(double) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/ostream:217: note:
std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT,
_Traits>::operator<<(float) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:265: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(long double) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:288: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(const void*) [with _CharT = char, _Traits =
std::char_traits<char>]
/usr/include/c++/4.0.0/bits/ostream.tcc:311: note:
std::basic_ostream<CharT1, Tr>& std::basic_ostream<_CharT,
_Traits>::operator<<(std::basic_streambuf<_CharT, _Traits>*) [with
_CharT = char, _Traits = std::char_traits<char>]
Sorry about that. The following code will work as a workaround, but I
was wondering what others are doing when they have a wstring.
std::wstring testString;
BOOST_CHECK_EQUAL(testString.c_str(), L"");
Jared
On Aug 26, 2009, at 3:39 PM, Ryan Gallagher wrote:
> Jared McIntyre <jmcintyre <at> dfsoftware.com> writes:
>
>>
>> I'm having an issue testing against wstrings:
>>
>> std::wstring testString("");
>> BOOST_CHECK_EQUAL(testString,L"");
>>
>
> try:
>
> std::wstring testString;
>
> or
>
> std::wstring testString(L"");
>
> -Ryan
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk