mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Pavel Labath
ed1f03baaf
[Error/unittests] Add a FailedWithMessage gtest matcher
Summary: We already have a "Failed" matcher, which can be used to check any property of the Error object. However, most frequently one just wants to check the error message, and while this is possible with the "Failed" matcher, it is also very convoluted (Failed<ErrorInfoBase>(testing::Property(&ErrorInfoBase::message, "the message"))). Now, one can just write: FailedWithMessage("the message"). I expect that most of the usages will remain this simple, but the argument of the matcher is not limited to simple strings -- the argument of the matcher can be any other matcher, so one can write more complicated assertions if needed (FailedWithMessage(ContainsRegex("foo|bar"))). If one wants to match multiple error messages, he can pass multiple arguments to the matcher. If one wants to match the message list as a whole (perhaps to check the message count), I've also included a FailedWithMessageArray matcher, which takes a single matcher receiving a vector of error message strings. Reviewers: sammccall, dblaikie, jhenderson Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D74898
The LLVM Compiler Infrastructure ================================ This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments. LLVM is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. Please see the documentation provided in docs/ for further assistance with LLVM, and in particular docs/GettingStarted.rst for getting started with LLVM and docs/README.txt for an overview of LLVM's documentation setup. If you are writing a package for LLVM, see docs/Packaging.rst for our suggestions.
Description
Languages
C++
96.9%
C
1%
Python
1%
CMake
0.6%
OCaml
0.2%
Other
0.1%