Added testDoesNotIdentifyCallback for #2480

TODO
This commit is contained in:
Pete Johns 2011-01-18 21:50:22 +11:00
parent 0e1bab6dc3
commit 75767705c7
1 changed files with 30 additions and 0 deletions

View File

@ -60,6 +60,7 @@ private:
// #2407 - FP when called from operator()
TEST_CASE(fp_operator);
TEST_CASE(testDoesNotIdentifyCallback); // #2480
}
@ -447,6 +448,35 @@ private:
TODO_ASSERT_EQUALS("[test.cpp:8]: (style) Unused private function 'Fred::startListening'\n", errout.str());
ASSERT_EQUALS("", errout.str());
}
void testDoesNotIdentifyCallback()
{
check("#include <iostream>"
"void callback(void (*func)(int), int arg)"
"{"
" (*func)(arg);"
"}"
"class MountOperation"
"{"
" static void Completed(int i);"
"public:"
" MountOperation(int i);"
"};"
"void MountOperation::Completed(int i)"
"{"
" std::cerr << i << std::endl;"
"}"
"MountOperation::MountOperation(int i)"
"{"
" callback(MountOperation::Completed, i);"
"}"
"int main(void)"
"{"
" MountOperation aExample(10);"
"}"
);
TODO_ASSERT_EQUALS("", errout.str());
}
};
REGISTER_TEST(TestUnusedPrivateFunction)