Fix support for typed tests and parameterized tests.
Bug: http://b/69425095
Test: run bionic_unit_tests --bionic-selftest
Change-Id: Ifa23288f2ad84978b7748da0ea93d650fae926a8
diff --git a/tests/gtest_main.cpp b/tests/gtest_main.cpp
index 781acce..3f59a9c 100644
--- a/tests/gtest_main.cpp
+++ b/tests/gtest_main.cpp
@@ -312,6 +312,7 @@
}
for (auto& line : android::base::Split(content, "\n")) {
+ line = android::base::Split(line, "#")[0];
line = android::base::Trim(line);
if (line.empty()) continue;
if (android::base::EndsWith(line, ".")) {
@@ -1265,3 +1266,24 @@
TEST_F(bionic_selftest_DeathTest, fail) {
ASSERT_EXIT(deathtest_helper_fail(), ::testing::ExitedWithCode(0), "");
}
+
+class BionicSelfTest : public ::testing::TestWithParam<bool> {
+};
+
+TEST_P(BionicSelfTest, test_success) {
+ ASSERT_EQ(GetParam(), GetParam());
+}
+
+INSTANTIATE_TEST_CASE_P(bionic_selftest, BionicSelfTest, ::testing::Values(true, false));
+
+template <typename T>
+class bionic_selftest_TestT : public ::testing::Test {
+};
+
+typedef ::testing::Types<char, int> MyTypes;
+
+TYPED_TEST_CASE(bionic_selftest_TestT, MyTypes);
+
+TYPED_TEST(bionic_selftest_TestT, test_success) {
+ ASSERT_EQ(true, true);
+}