| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "tools/gn/parse_tree.h" | 5 #include "tools/gn/parse_tree.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 | 219 |
| 220 TEST(ParseTree, Integers) { | 220 TEST(ParseTree, Integers) { |
| 221 static const char* const kGood[] = { | 221 static const char* const kGood[] = { |
| 222 "0", | 222 "0", |
| 223 "10", | 223 "10", |
| 224 "-54321", | 224 "-54321", |
| 225 "9223372036854775807", // INT64_MAX | 225 "9223372036854775807", // INT64_MAX |
| 226 "-9223372036854775808", // INT64_MIN | 226 "-9223372036854775808", // INT64_MIN |
| 227 }; | 227 }; |
| 228 for (auto s : kGood) { | 228 for (auto* s : kGood) { |
| 229 TestParseInput input(std::string("x = ") + s); | 229 TestParseInput input(std::string("x = ") + s); |
| 230 EXPECT_FALSE(input.has_error()); | 230 EXPECT_FALSE(input.has_error()); |
| 231 | 231 |
| 232 TestWithScope setup; | 232 TestWithScope setup; |
| 233 Err err; | 233 Err err; |
| 234 input.parsed()->Execute(setup.scope(), &err); | 234 input.parsed()->Execute(setup.scope(), &err); |
| 235 EXPECT_FALSE(err.has_error()); | 235 EXPECT_FALSE(err.has_error()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 static const char* const kBad[] = { | 238 static const char* const kBad[] = { |
| 239 "-0", | 239 "-0", |
| 240 "010", | 240 "010", |
| 241 "-010", | 241 "-010", |
| 242 "9223372036854775808", // INT64_MAX + 1 | 242 "9223372036854775808", // INT64_MAX + 1 |
| 243 "-9223372036854775809", // INT64_MIN - 1 | 243 "-9223372036854775809", // INT64_MIN - 1 |
| 244 }; | 244 }; |
| 245 for (auto s : kBad) { | 245 for (auto* s : kBad) { |
| 246 TestParseInput input(std::string("x = ") + s); | 246 TestParseInput input(std::string("x = ") + s); |
| 247 EXPECT_FALSE(input.has_error()); | 247 EXPECT_FALSE(input.has_error()); |
| 248 | 248 |
| 249 TestWithScope setup; | 249 TestWithScope setup; |
| 250 Err err; | 250 Err err; |
| 251 input.parsed()->Execute(setup.scope(), &err); | 251 input.parsed()->Execute(setup.scope(), &err); |
| 252 EXPECT_TRUE(err.has_error()); | 252 EXPECT_TRUE(err.has_error()); |
| 253 } | 253 } |
| 254 } | 254 } |
| OLD | NEW |