mirror of
https://fuchsia.googlesource.com/third_party/pigweed.googlesource.com/pigweed/pigweed
synced 2024-09-21 06:12:09 +00:00
pw_unit_test: Clang fixes
This makes two tweaks to enable compiling with Clang on the desktop: - Switch from (&function_pointer) to (*function_pointer) style. - Make destructor final in derived test class to prevent warning from the "-Wdelete-non-abstract-non-virtual-dtor" flag. Change-Id: Ic1783e41ee8092a5ad218ebdb48376742f85ff50
This commit is contained in:
parent
925fb8f510
commit
2b0e008a75
|
@ -202,7 +202,7 @@ struct TestInfo {
|
||||||
TestInfo(const char* const test_suite_name,
|
TestInfo(const char* const test_suite_name,
|
||||||
const char* const test_name,
|
const char* const test_name,
|
||||||
const char* const file_name,
|
const char* const file_name,
|
||||||
void (&run)())
|
void (*run)())
|
||||||
: test_suite_name(test_suite_name),
|
: test_suite_name(test_suite_name),
|
||||||
test_name(test_name),
|
test_name(test_name),
|
||||||
file_name(file_name),
|
file_name(file_name),
|
||||||
|
@ -221,7 +221,7 @@ struct TestInfo {
|
||||||
|
|
||||||
// Function which runs the test case. Refers to Framework::CreateAndRunTest
|
// Function which runs the test case. Refers to Framework::CreateAndRunTest
|
||||||
// instantiated for the test case's class.
|
// instantiated for the test case's class.
|
||||||
void (&run)();
|
void (*run)();
|
||||||
|
|
||||||
// TestInfo structs are registered with the test framework and stored as a
|
// TestInfo structs are registered with the test framework and stored as a
|
||||||
// linked list.
|
// linked list.
|
||||||
|
@ -276,7 +276,7 @@ class Test {
|
||||||
static_assert(sizeof(PW_STRINGIFY(test_name)) > 1, \
|
static_assert(sizeof(PW_STRINGIFY(test_name)) > 1, \
|
||||||
"test_name must not be empty"); \
|
"test_name must not be empty"); \
|
||||||
\
|
\
|
||||||
class _PW_TEST_CLASS_NAME(test_suite_name, test_name) \
|
class _PW_TEST_CLASS_NAME(test_suite_name, test_name) final \
|
||||||
: public parent_class { \
|
: public parent_class { \
|
||||||
public: \
|
public: \
|
||||||
_PW_TEST_CLASS_NAME(test_suite_name, test_name)() { \
|
_PW_TEST_CLASS_NAME(test_suite_name, test_name)() { \
|
||||||
|
@ -293,7 +293,7 @@ class Test {
|
||||||
PW_STRINGIFY(test_suite_name), \
|
PW_STRINGIFY(test_suite_name), \
|
||||||
PW_STRINGIFY(test_name), \
|
PW_STRINGIFY(test_name), \
|
||||||
__FILE__, \
|
__FILE__, \
|
||||||
&::pw::unit_test::internal::Framework::CreateAndRunTest< \
|
::pw::unit_test::internal::Framework::CreateAndRunTest< \
|
||||||
_PW_TEST_CLASS_NAME(test_suite_name, test_name)>); \
|
_PW_TEST_CLASS_NAME(test_suite_name, test_name)>); \
|
||||||
\
|
\
|
||||||
void _PW_TEST_CLASS_NAME(test_suite_name, test_name)::PigweedTestBody()
|
void _PW_TEST_CLASS_NAME(test_suite_name, test_name)::PigweedTestBody()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user