Skip to content

ENH: Changed test macros to copy result - #1709

Draft
JDuffeyBQ wants to merge 1 commit into
developfrom
topic/test_macro_enh
Draft

ENH: Changed test macros to copy result#1709
JDuffeyBQ wants to merge 1 commit into
developfrom
topic/test_macro_enh

Conversation

@JDuffeyBQ

@JDuffeyBQ JDuffeyBQ commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1704

SIMPLNX_RESULT_REQUIRE_VALID and SIMPLNX_RESULT_REQUIRE_INVALID now assign the input Result<T> to avoid macro duplication when the argument is an expression (may copy or move depending on input type).

For tests, I think the following typical form should still be preferred since it allows for easy access to the Result in the debugger. This PR mainly serves as a guard against unintended behavior.

  auto executeResult = filter.execute(dataStructure, args);
  SIMPLNX_RESULT_REQUIRE_VALID(executeResult.result);

- Wrapped inside do while block for formatting
- Now check that the argument to the macros is actually a Result

Signed-off-by: Jared Duffey <jared.duffey@bluequartz.net>
Comment on lines +48 to +49
{ Result{x} } -> std::same_as<T>;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[clang-format] reported by reviewdog 🐶

Suggested change
{ Result{x} } -> std::same_as<T>;
};
{
Result{x}
} -> std::same_as<T>;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SIMPLNX_RESULT_REQUIRE_VALID evaluates its argument 4+ times, silently re-running filter calls

1 participant