mirror of
https://github.com/boostorg/local_function.git
synced 2026-01-25 06:12:27 +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 TestReturnSetGet
|
||||
@@ -16,12 +19,12 @@ boost::function<const std::string& (void)> get;
|
||||
|
||||
void action(void) {
|
||||
// State `message` hidden behind access functions from here.
|
||||
BOOST_CHECK( get() == "abc" );
|
||||
BOOST_CHECK(get() == "abc");
|
||||
set("xyz");
|
||||
BOOST_CHECK( get() == "xyz" );
|
||||
BOOST_CHECK(get() == "xyz");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_return_setget ) {
|
||||
BOOST_AUTO_TEST_CASE(test_return_setget) {
|
||||
std::string message = "abc"; // Reference valid where closure used.
|
||||
|
||||
void BOOST_LOCAL_FUNCTION(bind& message, const std::string& text) {
|
||||
@@ -37,3 +40,9 @@ BOOST_AUTO_TEST_CASE( test_return_setget ) {
|
||||
action();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main(void) { return 0; } // Trivial test.
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user