* Prevent naming properties with reserved words (Fix #16846) * Prevent using reserved constant names for properties or aliases * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * App: Add unit test for isTokenAConstant --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
@@ -102,4 +102,19 @@ TEST_F(ExpressionParserTest, functionPARSEQUANT)
|
||||
|
||||
}
|
||||
|
||||
TEST_F(ExpressionParserTest, isTokenAConstant)
|
||||
{
|
||||
std::array<std::string, 7> constants {"pi", "e", "True", "False", "true", "false", "None"};
|
||||
for (const auto & constant : constants) {
|
||||
EXPECT_TRUE(App::ExpressionParser::isTokenAConstant(constant))
|
||||
<< "\"" << constant << "\" did not evaluate as a constant";
|
||||
}
|
||||
|
||||
std::array<std::string, 6> notConstants {"PI", "E", "TRUE", "FALSE", "NONE", "none"};
|
||||
for (const auto & nonConstant : notConstants) {
|
||||
EXPECT_FALSE(App::ExpressionParser::isTokenAConstant(nonConstant))
|
||||
<< "\"" << nonConstant << "\" evaluated as a constant";
|
||||
}
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
|
||||
Reference in New Issue
Block a user