summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/minicargo/build.cpp2
-rw-r--r--tools/minicargo/manifest.cpp13
2 files changed, 13 insertions, 2 deletions
diff --git a/tools/minicargo/build.cpp b/tools/minicargo/build.cpp
index 64558103..10c7f754 100644
--- a/tools/minicargo/build.cpp
+++ b/tools/minicargo/build.cpp
@@ -666,7 +666,7 @@ Builder::Builder(const BuildOptions& opts, size_t total_targets):
case PackageTarget::Type::Test:
if(crate_type)
*crate_type = "bin";
- outfile /= ::format(target.m_name, "-test", EXESUF);
+ outfile /= ::format(target.m_name, EXESUF);
break;
default:
throw ::std::runtime_error("Unknown target type being built");
diff --git a/tools/minicargo/manifest.cpp b/tools/minicargo/manifest.cpp
index 2a1493c8..28839d8b 100644
--- a/tools/minicargo/manifest.cpp
+++ b/tools/minicargo/manifest.cpp
@@ -353,7 +353,18 @@ PackageManifest PackageManifest::load_from_toml(const ::std::string& path)
}
}
- // TODO: if there's a lib target, add a test target using the same path
+ // If there's a lib target, add a test target using the same path
+ {
+ auto it = ::std::find_if(rv.m_targets.begin(), rv.m_targets.end(), [&](const auto& t) { return t.m_type == PackageTarget::Type::Lib; });
+ if( it != rv.m_targets.end() )
+ {
+ auto path = it->m_path;
+ auto name = it->m_name + "-test";
+ rv.m_targets.push_back(PackageTarget { PackageTarget::Type::Test });
+ rv.m_targets.back().m_name = name;
+ rv.m_targets.back().m_path = path;
+ }
+ }
for(const auto& dep : rv.m_dependencies)
{