diff options
Diffstat (limited to 'test/test_sqlite.cpp')
-rw-r--r-- | test/test_sqlite.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/test_sqlite.cpp b/test/test_sqlite.cpp index 8349324..2bb91a0 100644 --- a/test/test_sqlite.cpp +++ b/test/test_sqlite.cpp @@ -17,7 +17,6 @@ #include "fud_sqlite.hpp" #include "fud_string.hpp" -#include "test_common.hpp" #include "gtest/gtest.h" #include <cerrno> @@ -27,23 +26,27 @@ namespace fud { TEST(FudSqlite, Basic) { - const String testName{"test.db.sqlite"}; + auto testNameResult = String::makeFromCString("./test.db.sqlite"); + ASSERT_TRUE(testNameResult.isOkay()); + auto testName{std::move(testNameResult).takeOkay()}; auto result = unlink(testName.c_str()); if (result != 0) { ASSERT_EQ(errno, ENOENT); } - SqliteDb sqliteDb{testName, SqliteOpenMode::ReadOnly}; - ASSERT_FALSE(sqliteDb.valid()); - ASSERT_NE(sqliteDb.errorCode(), SQLITE_OK); + auto sqliteDbResult{SqliteDb::make(testName, SqliteOpenMode::ReadOnly)}; + ASSERT_FALSE(sqliteDbResult.isOkay()); - sqliteDb = SqliteDb{testName, SqliteOpenMode::ReadWrite}; - ASSERT_FALSE(sqliteDb.valid()); - ASSERT_NE(sqliteDb.errorCode(), SQLITE_OK); + sqliteDbResult = SqliteDb::make(testName, SqliteOpenMode::ReadWrite); + ASSERT_FALSE(sqliteDbResult.isOkay()); - sqliteDb = SqliteDb{testName, SqliteOpenMode::ReadWriteCreate}; + sqliteDbResult = SqliteDb::make(testName, SqliteOpenMode::ReadWriteCreate); + ASSERT_TRUE(sqliteDbResult.isOkay()); + + auto sqliteDb{std::move(sqliteDbResult).takeOkay()}; ASSERT_TRUE(sqliteDb.valid()); ASSERT_EQ(sqliteDb.errorCode(), SQLITE_OK); + } } // namespace fud |