| 270 | |
| 271 | template <typename I, bool Flattened = false> |
| 272 | void TestGetWithInvalidIndex() const { |
| 273 | const auto& input = case_->InputAs<I>(); |
| 274 | for (const auto& path : |
| 275 | {FieldPath({2, 1, 0}), FieldPath({1, 2, 0}), FieldPath{1, 1, 2}}) { |
| 276 | EXPECT_RAISES_WITH_MESSAGE_THAT(IndexError, |
| 277 | ::testing::HasSubstr("index out of range"), |
| 278 | DoGet<Flattened>(*input, path)); |
| 279 | } |
| 280 | EXPECT_RAISES_WITH_MESSAGE_THAT( |
| 281 | Invalid, ::testing::HasSubstr("empty indices cannot be traversed"), |
| 282 | DoGet<Flattened>(*input, FieldPath())); |
| 283 | } |
| 284 | |
| 285 | template <typename I, bool Flattened = false> |
| 286 | void TestIndexErrorMessage() const { |
nothing calls this directly
no test coverage detected