[core] Allow the use of special characters in property field names
Fixes #4336
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
namespace mbgl {
|
namespace mbgl {
|
||||||
namespace util {
|
namespace util {
|
||||||
|
|
||||||
const static std::string tokenReservedChars = "{}()[]<>$=:;.,^";
|
const static std::string tokenReservedChars = "{}";
|
||||||
|
|
||||||
// Replaces {tokens} in a string by calling the lookup function.
|
// Replaces {tokens} in a string by calling the lookup function.
|
||||||
template <typename Lookup>
|
template <typename Lookup>
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ TEST(Token, replaceTokens) {
|
|||||||
if (token == "dashed-property") return "dashed";
|
if (token == "dashed-property") return "dashed";
|
||||||
return "";
|
return "";
|
||||||
}));
|
}));
|
||||||
|
EXPECT_EQ("colonized", mbgl::util::replaceTokens("{colon:property}", [](const std::string& token) -> std::string {
|
||||||
|
if (token == "colon:property") return "colonized";
|
||||||
|
return "";
|
||||||
|
}));
|
||||||
EXPECT_EQ("150 m", mbgl::util::replaceTokens("{HØYDE} m", [](const std::string& token) -> std::string {
|
EXPECT_EQ("150 m", mbgl::util::replaceTokens("{HØYDE} m", [](const std::string& token) -> std::string {
|
||||||
if (token == "HØYDE") return "150";
|
if (token == "HØYDE") return "150";
|
||||||
return "";
|
return "";
|
||||||
}));
|
}));
|
||||||
EXPECT_EQ("reserved {for:future} use", mbgl::util::replaceTokens("reserved {for:future} use", [](const std::string& token) -> std::string {
|
|
||||||
if (token == "for:future") return "unknown";
|
|
||||||
return "";
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user