Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: various fixes #1

Merged
merged 4 commits into from
Jan 5, 2024
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
26 changes: 11 additions & 15 deletions cucumber-cpp/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,45 +61,43 @@ namespace cucumber_cpp

for (auto current = view.begin(); current != view.end(); ++current)
{
using std::operator""sv;

const auto arg = *current;
if (arg == "--tag"sv)
if (arg == "--tag")
{
while (std::next(current) != view.end() && (!(*std::next(current)).starts_with("-")))
{
current = std::next(current);
tags.push_back(*current);
}
}
else if (arg == "--feature"sv)
else if (arg == "--feature")
{
while (std::next(current) != view.end() && (!(*std::next(current)).starts_with("-")))
{
current = std::next(current);
features.push_back(*current);
}
}
else if (arg == "--report"sv)
else if (arg == "--report")
{
while (std::next(current) != view.end() && (!(*std::next(current)).starts_with("-")))
{
current = std::next(current);
reports.push_back(*current);
}
}
else if (arg.starts_with("--Xapp,"sv))
else if (arg.starts_with("--Xapp,"))
{
const auto param = arg.substr("--Xapp,"sv.size());
const auto param = arg.substr(std::string_view("--Xapp,").size());

for (const auto xArg : std::views::split(param, ","sv))
for (const auto xArg : std::views::split(param, ","))
{
forwardArgs.push_back(subrange_to_sv(xArg));
}
}
else
{
if (!(arg == "--help"sv && arg == "-h"sv))
if (!(arg == "--help" && arg == "-h"))
{
std::cout << "\nUnkown argument: " << std::quoted(arg) << "\n";
}
Expand Down Expand Up @@ -186,7 +184,7 @@ namespace cucumber_cpp
app.parse(gherkin::file{ std::string{ feature } }, cbs);
}

const auto tagExpression = std::accumulate(std::next(options.tags.begin()), options.tags.end(), std::string(options.tags.front()), JoinStringWithSpace);
const auto tagExpression = options.tags.empty() ? std::string() : std::accumulate(std::next(options.tags.begin()), options.tags.end(), std::string(options.tags.front()), JoinStringWithSpace);

CucumberRunner cucumberRunner{ GetForwardArgs(), hooks, stepRepository, tagExpression, contextStorageFactory };
cucumberRunner.Run(root);
Expand All @@ -199,21 +197,19 @@ namespace cucumber_cpp

void Application::GenerateReports(std::map<std::string_view, report::Report&> additionalReports)
{
using std::operator""sv;

if (std::ranges::find(options.reports, "json"sv) != options.reports.end())
if (std::ranges::find(options.reports, "json") != options.reports.end())
{
cucumber_cpp::report::JsonReport report;
report.GenerateReport(root);
}

if (std::ranges::find(options.reports, "console"sv) != options.reports.end())
if (std::ranges::find(options.reports, "console") != options.reports.end())
{
cucumber_cpp::report::StdOutReport report;
report.GenerateReport(root);
}

if (std::ranges::find(options.reports, "junit-xml"sv) != options.reports.end())
if (std::ranges::find(options.reports, "junit-xml") != options.reports.end())
{
cucumber_cpp::report::JunitReport junitReport;
junitReport.GenerateReport(root);
Expand Down
2 changes: 1 addition & 1 deletion cucumber-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ target_link_libraries(cucumber-cpp PUBLIC
)

target_compile_options(cucumber-cpp PRIVATE
-Wno-deprecated-declarations
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
)

add_subdirectory(report)
Expand Down
2 changes: 1 addition & 1 deletion cucumber-cpp/Context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ namespace cucumber_cpp
template<class T>
[[deprecated("Use InsertAt or InsertRefAt")]] void SetShared(std::string_view key, const std::shared_ptr<T>& value)
{
Assign(key, value);
storage->Assign(key, value);
}

template<class T, class... Args>
Expand Down