Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow fuzzy matching on test result #3432

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/test_files/copy/export_import_db.test
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Binder exception: Directory ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db5 does not
-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.
^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
Loading