| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "tools/gn/err.h" | 6 #include "tools/gn/err.h" |
| 7 #include "tools/gn/input_conversion.h" | 7 #include "tools/gn/input_conversion.h" |
| 8 #include "tools/gn/input_file.h" | 8 #include "tools/gn/input_file.h" |
| 9 #include "tools/gn/parse_tree.h" | 9 #include "tools/gn/parse_tree.h" |
| 10 #include "tools/gn/scheduler.h" | 10 #include "tools/gn/scheduler.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 "print(5)", | 151 "print(5)", |
| 152 | 152 |
| 153 // Trailing junk not allowed. | 153 // Trailing junk not allowed. |
| 154 "233105-1", | 154 "233105-1", |
| 155 | 155 |
| 156 // Non-literals hidden in arrays are not allowed. | 156 // Non-literals hidden in arrays are not allowed. |
| 157 "[233105 - 1]", | 157 "[233105 - 1]", |
| 158 "[rebase_path(\"//\")]", | 158 "[rebase_path(\"//\")]", |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 for (auto test : kTests) { | 161 for (auto* test : kTests) { |
| 162 Err err; | 162 Err err; |
| 163 std::string input(test); | 163 std::string input(test); |
| 164 Value result = ConvertInputToValue(settings(), input, nullptr, | 164 Value result = ConvertInputToValue(settings(), input, nullptr, |
| 165 Value(nullptr, "value"), &err); | 165 Value(nullptr, "value"), &err); |
| 166 EXPECT_TRUE(err.has_error()) << test; | 166 EXPECT_TRUE(err.has_error()) << test; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Passing none or the empty string for input conversion should ignore the | 170 // Passing none or the empty string for input conversion should ignore the |
| 171 // result. | 171 // result. |
| 172 TEST_F(InputConversionTest, Ignore) { | 172 TEST_F(InputConversionTest, Ignore) { |
| 173 Err err; | 173 Err err; |
| 174 Value result = ConvertInputToValue(settings(), "foo", nullptr, Value(), &err); | 174 Value result = ConvertInputToValue(settings(), "foo", nullptr, Value(), &err); |
| 175 EXPECT_FALSE(err.has_error()); | 175 EXPECT_FALSE(err.has_error()); |
| 176 EXPECT_EQ(Value::NONE, result.type()); | 176 EXPECT_EQ(Value::NONE, result.type()); |
| 177 | 177 |
| 178 result = | 178 result = |
| 179 ConvertInputToValue(settings(), "foo", nullptr, Value(nullptr, ""), &err); | 179 ConvertInputToValue(settings(), "foo", nullptr, Value(nullptr, ""), &err); |
| 180 EXPECT_FALSE(err.has_error()); | 180 EXPECT_FALSE(err.has_error()); |
| 181 EXPECT_EQ(Value::NONE, result.type()); | 181 EXPECT_EQ(Value::NONE, result.type()); |
| 182 } | 182 } |
| OLD | NEW |