Googletest export
Add a breadcrumb about nullopt comparison near the Optional() matcher. Also add a note about how otherwise-spurious 'Eq()' may be needed in some cases. Without this, something like Field(&MyStruct::optional_field_without_equals_equals, absl::nullopt) doesn't work - it converts the nullopt to an optional<> of the non-equalable type, and fails to select the operator==(optional<>, nullopt_t) overload. The Eq() lets the type persist later into the match. PiperOrigin-RevId: 281305519
This commit is contained in:
		
				
					committed by
					
						
						Gennadiy Civil
					
				
			
			
				
	
			
			
			
						parent
						
							50cfbb726b
						
					
				
				
					commit
					4bf466236d
				
			@@ -266,7 +266,7 @@ Matcher                     | Description
 | 
				
			|||||||
| `IsTrue()`             | `argument` evaluates to `true` in a Boolean context. |
 | 
					| `IsTrue()`             | `argument` evaluates to `true` in a Boolean context. |
 | 
				
			||||||
| `IsNull()`             | `argument` is a `NULL` pointer (raw or smart).      |
 | 
					| `IsNull()`             | `argument` is a `NULL` pointer (raw or smart).      |
 | 
				
			||||||
| `NotNull()`            | `argument` is a non-null pointer (raw or smart).    |
 | 
					| `NotNull()`            | `argument` is a non-null pointer (raw or smart).    |
 | 
				
			||||||
| `Optional(m)`          | `argument` is `optional<>` that contains a value matching `m`. |
 | 
					| `Optional(m)`          | `argument` is `optional<>` that contains a value matching `m`. (For testing whether an `optional<>` is set, check for equality with `nullopt`. You may need to use `Eq(nullopt)` if the inner type doesn't have `==`.)|
 | 
				
			||||||
| `VariantWith<T>(m)`    | `argument` is `variant<>` that holds the alternative of type T with a value matching `m`. |
 | 
					| `VariantWith<T>(m)`    | `argument` is `variant<>` that holds the alternative of type T with a value matching `m`. |
 | 
				
			||||||
| `Ref(variable)`        | `argument` is a reference to `variable`.            |
 | 
					| `Ref(variable)`        | `argument` is a reference to `variable`.            |
 | 
				
			||||||
| `TypedEq<type>(value)` | `argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded. |
 | 
					| `TypedEq<type>(value)` | `argument` has type `type` and is equal to `value`. You may need to use this instead of `Eq(value)` when the mock function is overloaded. |
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user