| 205 | |
| 206 | |
| 207 | Test * |
| 208 | TestPath::findActualRoot( Test *searchRoot, |
| 209 | const std::string &pathAsString, |
| 210 | PathTestNames &testNames ) |
| 211 | { |
| 212 | bool isRelative = splitPathString( pathAsString, testNames ); |
| 213 | |
| 214 | if ( isRelative && pathAsString.empty() ) |
| 215 | return searchRoot; |
| 216 | |
| 217 | if ( testNames.empty() ) |
| 218 | throw std::invalid_argument( "TestPath::TestPath(): invalid root or root name in absolute path" ); |
| 219 | |
| 220 | Test *root = isRelative ? searchRoot->findTest( testNames[0] ) // throw if bad test name |
| 221 | : searchRoot; |
| 222 | if ( root->getName() != testNames[0] ) |
| 223 | throw std::invalid_argument( "TestPath::TestPath(): searchRoot does not match path root name" ); |
| 224 | |
| 225 | return root; |
| 226 | } |
| 227 | |
| 228 | |
| 229 | bool |