Skip to content

Commit

Permalink
fix old test and change regex handling
Browse files Browse the repository at this point in the history
  • Loading branch information
yiyun-sj committed May 1, 2024
1 parent 2043c0a commit 0e7ffe1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions test/test_files/copy/export_import_db.test
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ Binder exception: Directory ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db5 does not
-REMOVE_FILE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4/schema.cypher"
-IMPORT_DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4"
-STATEMENT IMPORT DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4"
---- error(regex)
Binder exception: File ${KUZU_EXPORT_DB_DIRECTORY}_case3/demo-db4/schema.cypher does not exist.
---- error
Binder exception: File ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4/schema.cypher does not exist.


-CASE ExportImportDatabaseRelGroup
Expand Down
12 changes: 3 additions & 9 deletions test/test_runner/test_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,9 @@ bool TestRunner::checkLogicalPlan(std::unique_ptr<PreparedStatement>& preparedSt
spdlog::info("EXPECTED ERROR: {}", expectedError);
} else if (statement->expectedErrorRegex) {
std::string expectedError = StringUtils::rtrim(result->getErrorMessage());
std::regex pattern("^.*[\\\\/]+([^\\\\/]+)$");
std::smatch match1;
bool is_match1 = std::regex_match(expectedError, match1, pattern);
std::smatch match2;
bool is_match2 = std::regex_match(statement->errorMessage, match2, pattern);
if (is_match1 && is_match2) {
if (match1[1] == match2[1]) {
return true;
}
std::regex pattern(statement->errorMessage);
if (std::regex_match(expectedError, pattern)) {
return true;
}
spdlog::info("EXPECTED ERROR: {}", expectedError);
} else if (statement->expectedOk && result->isSuccess()) {
Expand Down

0 comments on commit 0e7ffe1

Please sign in to comment.