[core] harden OfflineDatabase

This commit is contained in:
Konstantin Käfer
2018-06-13 15:50:23 +02:00
parent a3b6fc1498
commit fa7b70945f
16 changed files with 1156 additions and 358 deletions

View File

@@ -38,12 +38,6 @@ TEST(SQLite, TEST_REQUIRES_WRITE(TryOpen)) {
auto result = mapbox::sqlite::Database::tryOpen("test/fixtures/offline_database/foobar123.db", mapbox::sqlite::ReadOnly);
ASSERT_TRUE(result.is<mapbox::sqlite::Exception>());
ASSERT_EQ(result.get<mapbox::sqlite::Exception>().code, mapbox::sqlite::ResultCode::CantOpen);
#ifndef __QT__
// Only non-Qt platforms are setting a logger on the SQLite object.
EXPECT_EQ(1u, log.count({ EventSeverity::Info, Event::Database, static_cast<int64_t>(mapbox::sqlite::ResultCode::CantOpen), "cannot open file" }, true));
EXPECT_EQ(1u, log.count({ EventSeverity::Info, Event::Database, static_cast<int64_t>(mapbox::sqlite::ResultCode::CantOpen), "No such file or directory" }, true));
#endif
EXPECT_EQ(0u, log.uncheckedCount());
}