summaryrefslogtreecommitdiff
path: root/tools/minicargo/manifest.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-06-16 15:31:50 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-06-16 15:31:50 +0800
commit0bde28a46eca5752f178c097047dabf73a250f5d (patch)
tree88216efe905d7b3d29b3af05d5c0ec28f650a2ab /tools/minicargo/manifest.cpp
parent7a758b499cd4b243d211ad16c758f1fd8795afc6 (diff)
downloadmrust-0bde28a46eca5752f178c097047dabf73a250f5d.tar.gz
Minicargo - Support for main unit test targets
Diffstat (limited to 'tools/minicargo/manifest.cpp')
-rw-r--r--tools/minicargo/manifest.cpp13
1 files changed, 12 insertions, 1 deletions
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)
{