forked from boostorg/regex
Merge bug fixes from Trunk - see history for full details.
[SVN r58234]
This commit is contained in:
@ -34,13 +34,13 @@ int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
int main()
|
||||
{
|
||||
regex_tA re;
|
||||
int result;
|
||||
unsigned int result;
|
||||
result = regcompA(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
printf("%s", buf);
|
||||
return result;
|
||||
}
|
||||
BOOST_TEST(re.re_nsub == 0);
|
||||
@ -51,11 +51,11 @@ int main()
|
||||
{
|
||||
char buf[256];
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
printf(buf);
|
||||
printf("%s", buf);
|
||||
regfreeA(&re);
|
||||
return result;
|
||||
}
|
||||
BOOST_TEST(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
BOOST_TEST(matches[0].rm_so == matches[0].rm_eo);
|
||||
regfreeA(&re);
|
||||
printf("no errors found\n");
|
||||
return boost::report_errors();
|
||||
|
@ -40,7 +40,7 @@ int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
||||
int main()
|
||||
{
|
||||
regex_t re;
|
||||
int result;
|
||||
unsigned result;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
{
|
||||
@ -48,8 +48,8 @@ int main()
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
char nbuf[256];
|
||||
for(int i = 0; i < 256; ++i)
|
||||
nbuf[i] = buf[i];
|
||||
printf(nbuf);
|
||||
nbuf[i] = static_cast<char>(buf[i]);
|
||||
printf("%s", nbuf);
|
||||
return result;
|
||||
}
|
||||
if(re.re_nsub != 0)
|
||||
@ -66,8 +66,8 @@ int main()
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
char nbuf[256];
|
||||
for(int i = 0; i < 256; ++i)
|
||||
nbuf[i] = buf[i];
|
||||
printf(nbuf);
|
||||
nbuf[i] = static_cast<char>(buf[i]);
|
||||
printf("%s", nbuf);
|
||||
regfree(&re);
|
||||
return result;
|
||||
}
|
||||
@ -77,7 +77,7 @@ int main()
|
||||
exit(-1);
|
||||
}
|
||||
regfree(&re);
|
||||
printf("no errors found\n");
|
||||
printf("%s", "no errors found\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,13 @@
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// This define keep ICU in it's own namespace: helps us to track bugs that would
|
||||
// otherwise go unnoticed:
|
||||
//
|
||||
#define U_USING_ICU_NAMESPACE 0
|
||||
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
@ -66,7 +73,7 @@ int main()
|
||||
boost::regex_constants::match_flag_type flgs = boost::regex_constants::match_default;
|
||||
std::string s1;
|
||||
std::wstring s2;
|
||||
UnicodeString us;
|
||||
U_NAMESPACE_QUALIFIER UnicodeString us;
|
||||
b = boost::u32regex_match(utf8_arch1(), utf8_arch1(), m1, e1, flgs);
|
||||
b = boost::u32regex_match(utf8_arch1(), utf8_arch1(), m1, e1);
|
||||
b = boost::u32regex_match(utf8_arch2(), utf8_arch2(), m2, e1, flgs);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "test.hpp"
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(disable:4127)
|
||||
#pragma warning(disable:4127 4428)
|
||||
#endif
|
||||
|
||||
void test_character_escapes()
|
||||
|
@ -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())
|
||||
|
@ -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(...)
|
||||
{
|
||||
|
@ -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(...)
|
||||
{
|
||||
|
@ -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(...)
|
||||
{
|
||||
|
@ -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()
|
||||
|
@ -161,7 +161,7 @@ startup1 up1;
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST(0 != &up1);
|
||||
(void)up1;
|
||||
|
||||
std::list<boost::shared_ptr<boost::thread> > threads;
|
||||
for(int i = 0; i < 2; ++i)
|
||||
|
Reference in New Issue
Block a user