Index: tools/gn/functions_unittest.cc |
diff --git a/tools/gn/functions_unittest.cc b/tools/gn/functions_unittest.cc |
index 74ca6054a0b081ea3907315f0eefe27380e8ea38..7a948f8bcbaf41ce674c5d8540c5d7e3d4436a8b 100644 |
--- a/tools/gn/functions_unittest.cc |
+++ b/tools/gn/functions_unittest.cc |
@@ -11,7 +11,6 @@ |
TEST(Functions, Defined) { |
TestWithScope setup; |
- //InputFile input_file(SourceFile("//foo")); |
FunctionCallNode function_call; |
Err err; |
@@ -52,4 +51,18 @@ TEST(Functions, Defined) { |
&args_list_accessor_defined, &err); |
ASSERT_EQ(Value::BOOLEAN, result.type()); |
EXPECT_FALSE(result.boolean_value()); |
+ |
+ // Defined for a dictionary is a different codepath than a scope. |
+ Value dict_value(NULL, Value::DICT); |
+ dict_value.dict_value()["def"] = Value(NULL, "foo"); |
+ |
+ setup.scope()->SetValue("def", dict_value, NULL); |
+ result = functions::RunDefined(setup.scope(), &function_call, |
+ &args_list_identifier_defined, &err); |
+ ASSERT_EQ(Value::BOOLEAN, result.type()); |
+ EXPECT_TRUE(result.boolean_value()); |
+ result = functions::RunDefined(setup.scope(), &function_call, |
+ &args_list_accessor_defined, &err); |
+ ASSERT_EQ(Value::BOOLEAN, result.type()); |
+ EXPECT_FALSE(result.boolean_value()); |
} |