Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
result.hh File Reference
#include "nix/util/result.hh"
#include "nix/util/system-error.hh"
#include <gtest/gtest.h>
#include <source_location>

Go to the source code of this file.

Functions

template<typename T>
T nix::testing::valueOrFail (Result< T, NativeError > &&result, std::source_location loc=std::source_location::current())

Function Documentation

◆ valueOrFail()

template<typename T>
T nix::testing::valueOrFail ( Result< T, NativeError > && result,
std::source_location loc = std::source_location::current() )

The value of result, or else fail the test with its error.

This is for results a test needs in order to carry on, such as opening its temporary directory. Results that are what the test is checking should be checked with ASSERT_* or EXPECT_* directly instead.