Start fixing up Matchers: namespaces, composition ops

This commit also forbids composing lvalues of composed matchers, as
per previous deprecation notice. I do not expect this to be contentious
in practice, because there was a bug in that usage for years, and
nobody complained.
This commit is contained in:
Martin Hořeňovský
2020-02-18 23:31:16 +01:00
parent a1be19aa1b
commit cf6575576f
22 changed files with 230 additions and 296 deletions

View File

@@ -9,34 +9,6 @@ either of these is a breaking change, and thus will not happen until
at least the next major release.
### Composing lvalues of already composed matchers
Because a significant bug in this use case has persisted for 2+ years
without a bug report, and to simplify the implementation, code that
composes lvalues of composed matchers will not compile. That is,
this code will no longer work:
```cpp
auto m1 = Contains("string");
auto m2 = Contains("random");
auto composed1 = m1 || m2;
auto m3 = Contains("different");
auto composed2 = composed1 || m3;
REQUIRE_THAT(foo(), !composed1);
REQUIRE_THAT(foo(), composed2);
```
Instead you will have to write this:
```cpp
auto m1 = Contains("string");
auto m2 = Contains("random");
auto m3 = Contains("different");
REQUIRE_THAT(foo(), !(m1 || m2));
REQUIRE_THAT(foo(), m1 || m2 || m3);
```
## Planned changes

View File

@@ -53,6 +53,7 @@
* The description type now must be a `const char*` or implicitly convertible to it
* The `[!hide]` tag has been removed.
* Use `[.]` or `[.foo]` instead.
* Lvalues of composed matchers cannot be composed further
### Fixes
* The `INFO` macro no longer contains superfluous semicolon (#1456)