| 14050 | } |
| 14051 | |
| 14052 | TestCase makeTestCase( ITestInvoker* _testCase, |
| 14053 | std::string const& _className, |
| 14054 | NameAndTags const& nameAndTags, |
| 14055 | SourceLineInfo const& _lineInfo ) |
| 14056 | { |
| 14057 | bool isHidden = false; |
| 14058 | |
| 14059 | // Parse out tags |
| 14060 | std::vector<std::string> tags; |
| 14061 | std::string desc, tag; |
| 14062 | bool inTag = false; |
| 14063 | for (char c : nameAndTags.tags) { |
| 14064 | if( !inTag ) { |
| 14065 | if( c == '[' ) |
| 14066 | inTag = true; |
| 14067 | else |
| 14068 | desc += c; |
| 14069 | } |
| 14070 | else { |
| 14071 | if( c == ']' ) { |
| 14072 | TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); |
| 14073 | if( ( prop & TestCaseInfo::IsHidden ) != 0 ) |
| 14074 | isHidden = true; |
| 14075 | else if( prop == TestCaseInfo::None ) |
| 14076 | enforceNotReservedTag( tag, _lineInfo ); |
| 14077 | |
| 14078 | // Merged hide tags like `[.approvals]` should be added as |
| 14079 | // `[.][approvals]`. The `[.]` is added at later point, so |
| 14080 | // we only strip the prefix |
| 14081 | if (startsWith(tag, '.') && tag.size() > 1) { |
| 14082 | tag.erase(0, 1); |
| 14083 | } |
| 14084 | tags.push_back( tag ); |
| 14085 | tag.clear(); |
| 14086 | inTag = false; |
| 14087 | } |
| 14088 | else |
| 14089 | tag += c; |
| 14090 | } |
| 14091 | } |
| 14092 | if( isHidden ) { |
| 14093 | // Add all "hidden" tags to make them behave identically |
| 14094 | tags.insert( tags.end(), { ".", "!hide" } ); |
| 14095 | } |
| 14096 | |
| 14097 | TestCaseInfo info( static_cast<std::string>(nameAndTags.name), _className, desc, tags, _lineInfo ); |
| 14098 | return TestCase( _testCase, std::move(info) ); |
| 14099 | } |
| 14100 | |
| 14101 | void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) { |
| 14102 | std::sort(begin(tags), end(tags)); |
no test coverage detected