From 09ffc73b6ebf96158028f16e849cc35b2de0ab42 Mon Sep 17 00:00:00 2001 From: Duy-Nguyen Ta Date: Fri, 15 May 2015 08:44:15 -0400 Subject: [PATCH] convenient macro declaring friend for unittest classes to test private methods --- CppUnitLite/Test.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CppUnitLite/Test.h b/CppUnitLite/Test.h index ff1f1b692..23d1e2573 100644 --- a/CppUnitLite/Test.h +++ b/CppUnitLite/Test.h @@ -68,6 +68,12 @@ protected: testGroup##testName##Instance; \ void testGroup##testName##Test::run (TestResult& result_) +/** + * Declare friend in a class to test its private methods + */ +#define FRIEND_TEST(testGroup, testName) \ + friend class testGroup##testName##Test; + /** * For debugging only: use TEST_UNSAFE to allow debuggers to have access to exceptions, as this * will not wrap execution with a try/catch block