Verify that the ExpressionMatch test data for test
trimMultiWildcardWhitespace won't try to access out of bounds data by
changing EXPECT to ASSERT for patternPair.size() == 2.
If the test data is wrong, the results will be undefined, so there's
no point in continuing the test.
Alternative: use std::vector's .at() function, which will raise a
runtime error if out of bounds.
QString result;
for (auto&& patternPair : patterns) {
// Make sure data is valid
- EXPECT_TRUE(patternPair.size() == 2);
+ ASSERT_TRUE(patternPair.size() == 2);
// Run transformation
result = ExpressionMatch::trimMultiWildcardWhitespace(patternPair[PATTERN_SOURCE]);
// Assert that source trims into expected pattern