mirror of
https://github.com/google/googletest.git
synced 2025-03-22 12:23:48 +00:00
3.6 KiB
3.6 KiB
Useful Matchers Defined Outside of gMock
std::tuple
deps: "//util/tuple:matchers"
#include "util/tuple/matchers.h"
In namespace util::tuple::testing
:
`Tuple(m0, m1, ..., mn)` | `argument` is a `std::tuple` const reference with `n + 1` elements, where the i-th element matches `std::get*(argument)` |
`FieldPairsAre(m0, m1, ..., mn)` | matches a pair (2-tuple) of tuples where matcher `mi` matches the i-th fields of the tuples; usually for use inside `Pointwise()` or `UnorderedPointwise()` |
Web
deps: "//webutil/url:test_utils"
#include "webutil/url/test_utils.h"
`webutil_url::testing::HasUrlArg(key)` | `argument` is a URL string that has a query argument whose name is `key`. E.g. `http://foo.com/bar?key=value` |
`webutil_url::testing::HasUrlArg(key, m)` | `argument` is a URL string that has a query argument whose name is `key` and whose value matches `m`. |
`webutil_url::testing::HasUrlPathParam(key)` | `argument` is a URL string that has a path parameter whose name is `key`. E.g. `http://foo.com/bar;key=value` |
`webutil_url::testing::HasUrlPathParam(key, m)` | `argument` is a URL string that has a path parameter whose name is `key` and whose value matches `m`. |
deps: "//third_party/jsoncpp:testing"
#include "third_party/jsoncpp/testing.h"
`Json::testing::EqualsJson(json)` | `argument` is a string that represents the same Json value as the `json` string does. |
Encoding
deps: "//testing/lib/util/coding:varint"
#include "testing/lib/util/coding/varint.h"
`testing_lib_util_coding::EncodesVarint64(n)` | `argument` is a string that represents a Varint encoding of `n`, a `uint64` value. |
XPath
deps: "//template/prototemplate/testing:xpath_matcher"
#include "template/prototemplate/testing/xpath_matcher.h"
`prototemplate::testing::MatchesXPath(str)` | `argument` is a well-formed HTML/XML string that matches the given [XPath](http://www.w3.org/TR/xpath/#contents) expression. |
Flume
deps: "//pipeline/flume/contrib:matchers"
#include "pipeline/flume/contrib/matchers.h"
`flume::testing::Kv(key_matcher, value_matcher)` | `argument` is a `KV` where the key matches `key_matcher` and the value matches `value_matcher`. |
i18n strings
deps: "///i18n/testing/public:expecti18n"
#include "google3/i18n/testing/public/expecti18n.h"
`i18n_testing::I18nEq(utf8)` | `argument` is a `absl::string_view` whose content matches `utf8` allowing for locale data changes. In case it does not match, the error message contains both a readable version of both strings and the list of decoded codepoints. |