Improve file macro trim on windows (#18600)

* On windows try trim forward slash in __FILE__

* Improve exception relative path test assertion
check path with OS native and forward slash
This commit is contained in:
Pawel Raasz 2023-07-18 18:09:26 +02:00 committed by GitHub
parent fe7b19af6a
commit 568d3371d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,11 @@ TEST(check, ngraph_check_with_explanation) {
}
TEST(check, ov_throw_exception_check_relative_path_to_source) {
using namespace testing;
const auto path = ov::util::path_join({"src", "core", "tests", "check.cpp"});
const auto exp_msg = "Exception from " + path + ":" + std::to_string(__LINE__ + 1) + ":\nTest message";
OV_EXPECT_THROW(OPENVINO_THROW("Test message"), ov::Exception, testing::HasSubstr(exp_msg));
const auto exp_native_slash = "Exception from " + path + ":";
const auto exp_fwd_slash = "Exception from src/core/tests/check.cpp:";
OV_EXPECT_THROW(OPENVINO_THROW("Test message"),
ov::Exception,
AnyOf(StartsWith(exp_native_slash), StartsWith(exp_fwd_slash)));
}