diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/eval_env.cc | 4 | ||||
-rw-r--r-- | src/ninja_test.cc | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/eval_env.cc b/src/eval_env.cc index 0a53ae5..6b89b9c 100644 --- a/src/eval_env.cc +++ b/src/eval_env.cc @@ -56,8 +56,10 @@ bool EvalString::Parse(const string& input, string* err) { } else { for (end = start; end < input.size(); ++end) { char c = input[end]; - if (!(('a' <= c && c <= 'z') || ('0' <= c && c <= '9') || c == '_')) + if (!(('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || + ('0' <= c && c <= '9') || c == '_')) { break; + } } if (end == start) { *err = "expected variable after $"; diff --git a/src/ninja_test.cc b/src/ninja_test.cc index a90c334..bd4546b 100644 --- a/src/ninja_test.cc +++ b/src/ninja_test.cc @@ -64,6 +64,17 @@ TEST(EvalString, OneVariable) { env.vars["var"] = "there"; EXPECT_EQ("hi there", str.Evaluate(&env)); } +TEST(EvalString, OneVariableUpperCase) { + EvalString str; + string err; + EXPECT_TRUE(str.Parse("hi $VaR", &err)); + EXPECT_EQ("", err); + EXPECT_EQ("hi $VaR", str.unparsed()); + TestEnv env; + EXPECT_EQ("hi ", str.Evaluate(&env)); + env.vars["VaR"] = "there"; + EXPECT_EQ("hi there", str.Evaluate(&env)); +} TEST(EvalString, Error) { EvalString str; string err; |