Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: tools/gn/functions_unittest.cc

Issue 223783005: Add support for reading .gypi files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
}

Powered by Google App Engine
This is Rietveld 408576698