Test that is treated as invalid, with error offset and an error that contains substring . The last arguments are optional because most flat-out bad inputs are rejected without further information.
| 154 | // <expected_error_substr>. The last arguments are optional because most |
| 155 | // flat-out bad inputs are rejected without further information. |
| 156 | void TestInvalidString(const std::string& str, |
| 157 | const std::string& expected_error_substr = "") { |
| 158 | auto status_or_string = ParseStringLiteral(str); |
| 159 | EXPECT_THAT(status_or_string, StatusIs(absl::StatusCode::kInvalidArgument)); |
| 160 | EXPECT_TRUE(absl::StrContains(status_or_string.status().message(), |
| 161 | expected_error_substr)); |
| 162 | } |
| 163 | |
| 164 | // Test that <str> is treated as invalid, with error offset |
| 165 | // <expected_error_offset> and an error that contains substring |
no test coverage detected