Merge bug fixes from Trunk - see history for full details.

[SVN r58234]
This commit is contained in:
John Maddock
2009-12-08 12:42:33 +00:00
parent 95ddff1f01
commit ae79f29895
133 changed files with 1893 additions and 933 deletions

View File

@ -137,7 +137,7 @@ void test_deprecated(const char&, const test_regex_search_tag&)
if(test_info<char>::syntax_options() & ~boost::regex::icase)
return;
try{
boost::RegEx e(expression, test_info<char>::syntax_options() & boost::regex::icase);
boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
if(e.error_code())
{
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << e.error_code(), char);
@ -303,7 +303,7 @@ void test_deprecated(const char&, const test_invalid_regex_tag&)
return;
bool have_catch = false;
try{
boost::RegEx e(expression, test_info<char>::syntax_options() & boost::regex::icase);
boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
if(e.error_code())
have_catch = true;
}

View File

@ -12,7 +12,7 @@
#include "test.hpp"
#ifdef BOOST_MSVC
#pragma warning(disable:4127)
#pragma warning(disable:4127 4428)
#endif
void test_character_escapes()

View File

@ -564,7 +564,7 @@ void test_icu(const wchar_t&, const test_regex_replace_tag&)
//
// Now with UnicodeString:
//
UnicodeString expression16u, text16u, format16u, result16u, found16u;
U_NAMESPACE_QUALIFIER UnicodeString expression16u, text16u, format16u, result16u, found16u;
if(expression16.size())
expression16u.setTo(&*expression16.begin(), expression16.size());
if(text16.size())

View File

@ -86,15 +86,15 @@ void test(boost::basic_regex<charT, traits>& r, const test_invalid_regex_tag&)
have_catch = true;
test_empty(r);
}
catch(const std::runtime_error& r)
catch(const std::runtime_error& e)
{
have_catch = true;
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << r.what(), charT);
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << e.what(), charT);
}
catch(const std::exception& r)
catch(const std::exception& e)
{
have_catch = true;
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << r.what(), charT);
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << e.what(), charT);
}
catch(...)
{

View File

@ -56,13 +56,13 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_replace_tag&)
{
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), charT);
}
catch(const std::runtime_error& r)
catch(const std::runtime_error& e)
{
BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << r.what(), charT);
BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << e.what(), charT);
}
catch(const std::exception& r)
catch(const std::exception& e)
{
BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << r.what(), charT);
BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << e.what(), charT);
}
catch(...)
{

View File

@ -29,12 +29,17 @@
struct test_regex_search_tag{};
template <class BidirectionalIterator>
void test_sub_match(const boost::sub_match<BidirectionalIterator>& sub, BidirectionalIterator base, const int* answer_table, int i)
void test_sub_match(const boost::sub_match<BidirectionalIterator>& sub, BidirectionalIterator base, const int* answer_table, int i, bool recurse = true)
{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable:4244)
#endif
if(recurse)
{
boost::sub_match<BidirectionalIterator> copy(sub);
test_sub_match(copy, base, answer_table, i, false);
}
typedef typename boost::sub_match<BidirectionalIterator>::value_type charT;
if((sub.matched == 0)
&&
@ -71,8 +76,19 @@ void test_sub_match(const boost::sub_match<BidirectionalIterator>& sub, Bidirect
}
template <class BidirectionalIterator, class Allocator>
void test_result(const boost::match_results<BidirectionalIterator, Allocator>& what, BidirectionalIterator base, const int* answer_table)
void test_result(const boost::match_results<BidirectionalIterator, Allocator>& what, BidirectionalIterator base, const int* answer_table, bool recurse = true)
{
if(recurse)
{
boost::match_results<BidirectionalIterator, Allocator> copy(what);
test_result(copy, base, answer_table, false);
boost::match_results<BidirectionalIterator, Allocator> s;
s.swap(copy);
test_result(s, base, answer_table, false);
boost::match_results<BidirectionalIterator, Allocator> s2;
s2 = what;
test_result(s2, base, answer_table, false);
}
for(unsigned i = 0; i < what.size(); ++i)
{
test_sub_match(what[i], base, answer_table, i);
@ -508,13 +524,13 @@ void test(boost::basic_regex<charT, traits>& r, const test_regex_search_tag&)
{
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done: " << e.what(), charT);
}
catch(const std::runtime_error& r)
catch(const std::runtime_error& e)
{
BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << r.what(), charT);
BOOST_REGEX_TEST_ERROR("Received an unexpected std::runtime_error: " << e.what(), charT);
}
catch(const std::exception& r)
catch(const std::exception& e)
{
BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << r.what(), charT);
BOOST_REGEX_TEST_ERROR("Received an unexpected std::exception: " << e.what(), charT);
}
catch(...)
{

View File

@ -172,6 +172,7 @@ void test_simple_repeats()
TEST_REGEX_SEARCH("^a{0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
TEST_REGEX_SEARCH("^(?:a){0,1}?$", perl, "aaaaa", match_default, make_array(-2, -2));
TEST_REGEX_SEARCH("^a(?:bc)?", perl, "abcbc", match_any|match_all, make_array(-2, -2));
test_simple_repeats2();
}
void test_simple_repeats2()