Both the ASSERT_TRUE
and ASSERT_FALSE
does not compile in the LibraryTest
class with the error.
error C2664: 'std::basic_string<_Elem,_Traits,_Alloc>::basic_string(const std::basic_string<_Elem,_Traits,_Alloc> &)' : cannot convert parameter 1 from 'void' to 'const std::basic_string<_Elem,_Traits,_Alloc> &'
It works since in any TEST_F
I use.
But the EXPECT_FALSE
compiles fine in both the LibraryTest
class and the TEST_F
methods.
How can I use ASSERT
in the method used by a TEST_F
?
class LibraryTest : public ::testing::Test
{
public:
string create_library(string libName)
{
string libPath = setup_library_file(libName);
LibraryBrowser::reload_models();
ASSERT_FALSE(library_exists_at_path(libPath));
new_library(libName, libPath);
ASSERT_TRUE(library_exists_at_path(libPath));
EXPECT_FALSE(library_exists_at_path(libPath));
return libPath;
}
};
TEST_F(LibraryTest, libraries_changed)
{
string libName = "1xEVTestLibrary";
string libPath = create_library(libName);
}