Fixed unit tests on MSVC
This commit is contained in:
10
build.ps1
10
build.ps1
@@ -1,4 +1,10 @@
|
|||||||
param ($Prefix="C:\clang-uml", $BuildType="Release")
|
param ($Prefix="C:\clang-uml", $BuildType="Release")
|
||||||
|
|
||||||
cmake -S . -B .\_build\$BuildType -DCMAKE_PREFIX_PATH="$Prefix" -Thost=x64
|
cmake -S . -B $BuildType -DCMAKE_PREFIX_PATH="$Prefix" -Thost=x64
|
||||||
cmake --build .\_build\$BuildType --config $BuildType
|
cmake --build $BuildType --config $BuildType
|
||||||
|
|
||||||
|
# Create compile commands in Visual Studio
|
||||||
|
# before running these tests
|
||||||
|
cd $BuildType
|
||||||
|
ctest -C $BuildType --output-on-failure
|
||||||
|
cd ..
|
||||||
@@ -1135,9 +1135,14 @@ void translation_unit_visitor::ensure_lambda_type_is_relative(
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
auto root_name = fmt::format(
|
auto root_name = fmt::format(
|
||||||
"{}\\", std::filesystem::current_path().root_name().string());
|
"{}\\", std::filesystem::current_path().root_name().string());
|
||||||
|
if(root_name.back() == '\\') {
|
||||||
|
root_name.pop_back();
|
||||||
|
root_name.push_back('/');
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
auto root_name = std::string{"/"};
|
auto root_name = std::string{"/"};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string lambda_prefix{fmt::format("(lambda at {}", root_name)};
|
std::string lambda_prefix{fmt::format("(lambda at {}", root_name)};
|
||||||
|
|
||||||
while (parameter_type.find(lambda_prefix) != std::string::npos) {
|
while (parameter_type.find(lambda_prefix) != std::string::npos) {
|
||||||
|
|||||||
@@ -37,13 +37,19 @@ load_config(const std::string &test_name)
|
|||||||
{
|
{
|
||||||
auto config = clanguml::config::load(test_name + "/.clang-uml", true);
|
auto config = clanguml::config::load(test_name + "/.clang-uml", true);
|
||||||
|
|
||||||
|
LOG_DBG("Loading compilation database from {}",
|
||||||
|
config.compilation_database_dir());
|
||||||
|
|
||||||
std::string err{};
|
std::string err{};
|
||||||
auto compilation_database =
|
auto compilation_database =
|
||||||
clang::tooling::CompilationDatabase::autoDetectFromDirectory(
|
clang::tooling::CompilationDatabase::autoDetectFromDirectory(
|
||||||
config.compilation_database_dir(), err);
|
config.compilation_database_dir(), err);
|
||||||
|
|
||||||
if (!err.empty())
|
if (!err.empty()) {
|
||||||
|
LOG_ERROR("Failed to load compilation database from {}",
|
||||||
|
config.compilation_database_dir());
|
||||||
throw std::runtime_error{err};
|
throw std::runtime_error{err};
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_pair(std::move(config), std::move(compilation_database));
|
return std::make_pair(std::move(config), std::move(compilation_database));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user