sequence tests progress
This commit is contained in:
@@ -47,5 +47,6 @@ void QueryFixture::drop_table_if_exists(const std::string &table_name) const {
|
||||
}
|
||||
return utils::ok(true);
|
||||
});
|
||||
REQUIRE(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "SequenceFixture.hpp"
|
||||
|
||||
#include "matador/query/query.hpp"
|
||||
|
||||
#include "matador/sql/dialect.hpp"
|
||||
|
||||
#include "connection.hpp"
|
||||
|
||||
#include "catch2/catch_test_macros.hpp"
|
||||
|
||||
namespace matador::test {
|
||||
SequenceFixture::SequenceFixture()
|
||||
: db(connection::dns)
|
||||
, repo(db.dialect().default_schema_name()) {
|
||||
REQUIRE(db.open());
|
||||
}
|
||||
|
||||
SequenceFixture::~SequenceFixture() {
|
||||
while (!sequences_to_drop.empty()) {
|
||||
drop_sequence_if_exists(sequences_to_drop.top());
|
||||
sequences_to_drop.pop();
|
||||
}
|
||||
REQUIRE(repo.drop(db));
|
||||
REQUIRE(db.close());
|
||||
}
|
||||
|
||||
void SequenceFixture::check_sequence_exists(const std::string& sequence_name) const {
|
||||
}
|
||||
|
||||
void SequenceFixture::check_sequence_not_exists(const std::string& sequence_name) const {
|
||||
}
|
||||
|
||||
void SequenceFixture::drop_sequence_if_exists(const std::string& sequence_name) const {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef MATADOR_SEQUENCE_FIXTURE_HPP
|
||||
#define MATADOR_SEQUENCE_FIXTURE_HPP
|
||||
|
||||
|
||||
#include "matador/query/schema.hpp"
|
||||
|
||||
#include "matador/sql/connection.hpp"
|
||||
|
||||
#include <stack>
|
||||
|
||||
namespace matador::test {
|
||||
class SequenceFixture {
|
||||
public:
|
||||
SequenceFixture();
|
||||
~SequenceFixture();
|
||||
|
||||
void check_sequence_exists(const std::string &sequence_name) const;
|
||||
void check_sequence_not_exists(const std::string &sequence_name) const;
|
||||
|
||||
protected:
|
||||
sql::connection db;
|
||||
std::stack <std::string> sequences_to_drop;
|
||||
query::schema repo;
|
||||
|
||||
private:
|
||||
void drop_sequence_if_exists(const std::string &sequence_name) const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //MATADOR_SEQUENCE_FIXTURE_HPP
|
||||
Reference in New Issue
Block a user