Skip to content

Commit 6695453

Browse files
SL-9970 Refactored unit test
1 parent 477362c commit 6695453

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cppsqlite.test.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,14 @@ TEST(DbTest, openDir_ShouldThrow)
7979
std::cout << "Test cannot run: Failed to create test directory" << std::endl;
8080
return;
8181
}
82+
std::string expectedErrMsg;
8283
#ifdef OS_Windows
83-
EXPECT_THROW_WITH_MSG(db.open(tmp_dir.string().c_str(), SQLITE_OPEN_READONLY), CppSQLite3Exception,
84-
"SQLITE_CANTOPEN[14]: unable to open database file (SQLITE_CANTOPEN_ISDIR)");
84+
expectedErrMsg = "SQLITE_CANTOPEN[14]: unable to open database file (SQLITE_CANTOPEN_ISDIR)";
8585
#else
86-
EXPECT_THROW_WITH_MSG(db.open(tmp_dir.string().c_str(), SQLITE_OPEN_READONLY), CppSQLite3Exception,
87-
"SQLITE_IOERR[10]: disk I/O error (SQLITE_IOERR_READ)");
86+
expectedErrMsg = "SQLITE_IOERR[10]: disk I/O error (SQLITE_IOERR_READ)";
8887
#endif
88+
EXPECT_THROW_WITH_MSG(db.open(tmp_dir.string().c_str(), SQLITE_OPEN_READONLY), CppSQLite3Exception,
89+
expectedErrMsg.c_str());
8990
std::filesystem::remove(tmp_dir);
9091
}
9192
TEST(DbTest, writingToReadOnlyDatabaseShouldFail)

0 commit comments

Comments
 (0)