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

refactor(test_utils): return parser as optional #9391

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zulfaqar-azmi-t4
Copy link
Contributor

Description

It is possible the the parser function is being used incorrectly, which will return in correct results.

This PR refactor the function to return optional instead.

Related links

Parent Issue:

  • Link

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

@github-actions github-actions bot added component:planning Route planning, decision-making, and navigation. (auto-assigned) component:common Common packages from the autoware-common repository. (auto-assigned) labels Nov 20, 2024
Copy link

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@@ -581,7 +581,7 @@ TEST(ParseFunction, CompleteFromFilename)
const auto parser_test_route =
autoware_test_utils_dir + "/test_data/lanelet_route_parser_test.yaml";

const auto lanelet_route = parse<LaneletRoute>(parser_test_route);
const auto lanelet_route = *parse<std::optional<LaneletRoute>>(parser_test_route);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const auto lanelet_route = *parse<std::optional<LaneletRoute>>(parser_test_route);
if (const auto lanelet_route_opt = parse<std::optional<LaneletRoute>>(parser_test_route); lanelet_route_opt) {
const auto lanelet_route = lanelet_route_opt.value();
// do the tests ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (auto-assigned) component:planning Route planning, decision-making, and navigation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants