Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions phlex/core/product_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,23 @@ namespace phlex {

std::string product_selector::to_string() const
{
if (suffix) {
return fmt::format("{}/{} ϵ {}", creator, *suffix, layer);
}
return fmt::format("{} ϵ {}", creator, layer);
// Will generate <<suffix>::<concept> by <creator> (of <stage>) in <layer>>
using experimental::identifier;
std::string_view suffix_str =
suffix.transform(&identifier::operator std::string_view).value_or("[ANY]");
std::string type_str = this->type.valid() ? fmt::format("<{}>", this->type)
: "[UNSET TYPE]"; // will later be concept
auto layer_str = std::string_view(layer);
std::string_view creator_str = creator ? std::string_view(*creator) : "[ANY]";
std::string_view stage_str =
stage.transform(&identifier::operator std::string_view).value_or("[ANY]");

return fmt::format("<suffix {} (of type {}) by creator {} (of stage {}) in layer {}>",
suffix_str,
type_str,
creator_str,
stage_str,
layer_str);
}

bool product_selector::operator==(product_selector const& rhs) const
Expand Down
1 change: 1 addition & 0 deletions phlex/core/product_selector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ namespace phlex {

// NOLINTNEXTLINE(google-explicit-constructor) - Implicit conversion is intentional
operator T const&() const noexcept { return content_; }
explicit operator std::string_view() const noexcept { return std::string_view(content_); }
bool operator==(required_layer_name const&) const noexcept = default;

private:
Expand Down
11 changes: 6 additions & 5 deletions test/provider_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ TEST_CASE("Throw when two implicit providers are found for the same product")

CHECK_THROWS_WITH(
g.execute(),
ContainsSubstring(
"Multiple implicit providers found for product 'vertices_maker/happy_vertices") &&
ContainsSubstring("spill") && ContainsSubstring("passer"));
ContainsSubstring("Multiple implicit providers found for product '<suffix happy_vertices") &&
ContainsSubstring("by creator vertices_maker") && ContainsSubstring("in layer spill") &&
ContainsSubstring("node 'passer'"));
}

TEST_CASE("Throw when implicit provider insertion fails")
Expand All @@ -194,8 +194,9 @@ TEST_CASE("Throw when implicit provider insertion fails")

CHECK_THROWS_WITH(
g.execute(),
ContainsSubstring("Failed to create implicit provider for product selector 'vertices_maker/") &&
ContainsSubstring("happy_vertices") &&
ContainsSubstring(
"Failed to create implicit provider for product selector '<suffix happy_vertices") &&
ContainsSubstring("by creator vertices_maker") &&
ContainsSubstring(
"Implicit providers not yet supported for creators that created multiple data products"));
}
Loading