google / google/googletest

[FR]: Matcher for absl::StatusOr and std::expected

Open
#4,468 6 comments 1 reaction 0 assignees View on GitHub
enhancement priority: p3
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

### Does the feature exist in the most recent commit?

No

### Why do we need this feature?

Working on code bases that use C++23, std::expected is used extensively for error handling.
Having a _matcher_ for it would help on testing.

### Describe the proposal.

Similar to **VariantWith()** add a matcher that uses std::expected and it supports its monadic features.
Would be nice to check for compiler features.

### Is the feature specific to an operating system, compiler, or build system version?

As of this writing, the big 4 compiler library features support it.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing VariantWith() matcher and the project's compiler-feature support, then compare the APIs of absl::StatusOr and C++23 std::expected. Done means providing a matcher for the proposed types, including their monadic features, with appropriate compiler feature checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.