Skip to content

Commit cfe9b76

Browse files
committed
TestFixture: avoid repeated lookups in runTests()
1 parent 6a14618 commit cfe9b76

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

test/fixture.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,10 @@ std::size_t TestFixture::runTests(const options& args)
390390
// TODO: bail out when given class/test is not found?
391391
for (std::string classname : args.which_test()) {
392392
std::string testname;
393-
if (classname.find("::") != std::string::npos) {
394-
testname = classname.substr(classname.find("::") + 2);
395-
classname.erase(classname.find("::"));
393+
const std::string::size_type pos = classname.find("::");
394+
if (pos != std::string::npos) {
395+
testname = classname.substr(pos + 2);
396+
classname.erase(pos);
396397
}
397398

398399
for (TestInstance * test : TestRegistry::theInstance().tests()) {

0 commit comments

Comments
 (0)