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

Go to the source code of this file.

Classes

class  nix::testing::internal::HasSubstrIgnoreANSIMatcher

Functions

inline ::testing::PolymorphicMatcher< internal::HasSubstrIgnoreANSIMatcher > nix::testing::HasSubstrIgnoreANSIMatcher (const std::string &substring)
auto nix::testing::ThrowsSysError (int expected)
auto nix::testing::ThrowsSystemError (std::errc expected)
 nix::testing::MATCHER_P2 (HasContents, path, expected, "")
 nix::testing::MATCHER_P2 (HasSymlink, path, target, "")
 nix::testing::MATCHER_P2 (HasDirectory, path, dirents, "")

Function Documentation

◆ ThrowsSysError()

auto nix::testing::ThrowsSysError ( int expected)
inline

Matches a callable that throws SysError whose errNo equals expected.

Example:

EXPECT_THAT([&]{ openFile("nope"); }, ThrowsSysError(ENOENT));

◆ ThrowsSystemError()

auto nix::testing::ThrowsSystemError ( std::errc expected)
inline

Matches a callable that throws SystemError whose error code is equivalent to expected.

Example:

EXPECT_THAT([&]{ openFile("nope"); }, ThrowsSystemError(std::errc::no_such_file_or_directory));