-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathmov_ctor.cc
More file actions
31 lines (26 loc) · 812 Bytes
/
mov_ctor.cc
File metadata and controls
31 lines (26 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Fixing https://github.com/SqliteModernCpp/sqlite_modern_cpp/issues/63
#include <iostream>
#include <cstdlib>
#include <sqlite_modern_cpp.h>
#include <memory>
#include <catch2/catch.hpp>
using namespace sqlite;
using namespace std;
struct dbFront {
std::unique_ptr<database_binder> storedProcedure;
database db;
dbFront(): db(":memory:") {
db << "CREATE TABLE tbl (id integer, name string);";
// the temporary moved object should not run _execute() function on destruction.
storedProcedure = std::make_unique<database_binder>(
db << "INSERT INTO tbl VALUES (?, ?);"
);
}
};
TEST_CASE("database lifecycle", "move_ctor") {
bool failed = false;
try { dbFront dbf; }
catch(const sqlite_exception& e) { failed = true; }
catch(...) { failed = true; }
REQUIRE(failed == false);
}