forked from boostorg/function
Fix Boost.Function unit tests for C++0x. Fixes #3012
Based on a patch from Richard Webb. Changed a bit so that it also works for the Visual C++ 10 beta. [SVN r54618]
This commit is contained in:
@ -13,8 +13,8 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
using boost::function;
|
||||
using std::string;
|
||||
|
||||
int global_int;
|
||||
|
||||
@ -525,7 +525,7 @@ test_zero_args()
|
||||
static void
|
||||
test_one_arg()
|
||||
{
|
||||
negate<int> neg;
|
||||
std::negate<int> neg;
|
||||
|
||||
function<int (int)> f1(neg);
|
||||
BOOST_CHECK(f1(5) == -5);
|
||||
@ -607,12 +607,12 @@ struct add_with_throw_on_copy {
|
||||
|
||||
add_with_throw_on_copy(const add_with_throw_on_copy&)
|
||||
{
|
||||
throw runtime_error("But this CAN'T throw");
|
||||
throw std::runtime_error("But this CAN'T throw");
|
||||
}
|
||||
|
||||
add_with_throw_on_copy& operator=(const add_with_throw_on_copy&)
|
||||
{
|
||||
throw runtime_error("But this CAN'T throw");
|
||||
throw std::runtime_error("But this CAN'T throw");
|
||||
}
|
||||
};
|
||||
|
||||
@ -621,10 +621,10 @@ test_ref()
|
||||
{
|
||||
add_with_throw_on_copy atc;
|
||||
try {
|
||||
boost::function<int (int, int)> f(ref(atc));
|
||||
boost::function<int (int, int)> f(boost::ref(atc));
|
||||
BOOST_CHECK(f(1, 3) == 4);
|
||||
}
|
||||
catch(runtime_error e) {
|
||||
catch(std::runtime_error e) {
|
||||
BOOST_ERROR("Nonthrowing constructor threw an exception");
|
||||
}
|
||||
}
|
||||
@ -640,14 +640,14 @@ static void test_empty_ref()
|
||||
f2();
|
||||
BOOST_ERROR("Exception didn't throw for reference to empty function.");
|
||||
}
|
||||
catch(runtime_error e) {}
|
||||
catch(std::runtime_error e) {}
|
||||
|
||||
f1 = dummy;
|
||||
|
||||
try {
|
||||
f2();
|
||||
}
|
||||
catch(runtime_error e) {
|
||||
catch(std::runtime_error e) {
|
||||
BOOST_ERROR("Error calling referenced function.");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user