Add additional valid characters to parameter names

I feel as though the alphanumeric + `_` charset is too restrictive, especially when formatting complex objects into names.  Added a few extra characters which will help with this.
This commit is contained in:
Derek Brown 2020-01-14 18:23:30 -08:00 committed by GitHub
parent d854bd6acc
commit 4483e8137a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -634,6 +634,8 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
};
typedef ::std::vector<InstantiationInfo> InstantiationContainer;
static std::string validParamChars = "_-:/";
static bool IsValidParamName(const std::string& name) {
// Check for empty string
if (name.empty())
@ -641,7 +643,7 @@ class ParameterizedTestSuiteInfo : public ParameterizedTestSuiteInfoBase {
// Check for invalid characters
for (std::string::size_type index = 0; index < name.size(); ++index) {
if (!isalnum(name[index]) && name[index] != '_')
if (!isalnum(name[index]) && validParamChars.find(name[index]) == std::string::npos)
return false;
}