mirror of
https://github.com/boostorg/local_function.git
synced 2026-01-24 18:02:22 +00:00
Added test for sequence syntax (to run with and without variadic macro support) and disabled variadic syntax test when variadic macros are not supported.
Updated docs. [SVN r77078]
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// Home at http://www.boost.org/libs/local_function
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_VARIADIC_MACROS
|
||||
|
||||
#include <boost/local_function.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#define BOOST_TEST_MODULE TestReturnThis
|
||||
@@ -24,15 +27,21 @@ private:
|
||||
int value_;
|
||||
};
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_return_this ) {
|
||||
BOOST_AUTO_TEST_CASE(test_return_this) {
|
||||
number n1 = 0; // Object valid in scope where closure is used.
|
||||
boost::function<int (void)> inc1 = n1.inc();
|
||||
number n2 = 0;
|
||||
boost::function<int (void)> inc2 = n2.inc();
|
||||
|
||||
BOOST_CHECK( inc1() == 1 );
|
||||
BOOST_CHECK( inc1() == 2 );
|
||||
BOOST_CHECK( inc2() == 1 );
|
||||
BOOST_CHECK( inc1() == 3 );
|
||||
BOOST_CHECK(inc1() == 1);
|
||||
BOOST_CHECK(inc1() == 2);
|
||||
BOOST_CHECK(inc2() == 1);
|
||||
BOOST_CHECK(inc1() == 3);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main(void) { return 0; } // Trivial test.
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user