diff --git a/compiler/tests/unittest/end_to_end_jit_test.h b/compiler/tests/unittest/end_to_end_jit_test.h index cb73e9a38..bb3bec6bc 100644 --- a/compiler/tests/unittest/end_to_end_jit_test.h +++ b/compiler/tests/unittest/end_to_end_jit_test.h @@ -37,7 +37,13 @@ static bool assert_expected_success(llvm::Expected &&val) { // `true` if the test passes, otherwise `false`. template static bool assert_expected_failure(llvm::Expected &&val) { - return !assert_expected_success(val); + if (!((bool)val)) { + // We need to consume the error, so let's do it here + llvm::errs() << "assert_expected_failure: " + << llvm::toString(val.takeError()) << "\n"; + return true; + } + return false; } // Checks that the value `val` of type `llvm::Expected` is not in @@ -54,7 +60,7 @@ static bool assert_expected_failure(llvm::Expected &&val) { // an error state. #define ASSERT_EXPECTED_FAILURE(val) \ do { \ - if (assert_expected_success(val)) \ + if (!assert_expected_failure(val)) \ GTEST_FATAL_FAILURE_("Expected not in error state"); \ } while (0)