| Index: tools/gn/parse_tree_unittest.cc
|
| diff --git a/tools/gn/parse_tree_unittest.cc b/tools/gn/parse_tree_unittest.cc
|
| index 827f3d54a5ce55d630a750fdee6163f183646598..29a0faf36f951890f5475f1416908c3d3e5deceb 100644
|
| --- a/tools/gn/parse_tree_unittest.cc
|
| +++ b/tools/gn/parse_tree_unittest.cc
|
| @@ -212,3 +212,39 @@ TEST(ParseTree, SortRangeExtraction) {
|
| EXPECT_EQ(3u, ranges[0].end);
|
| }
|
| }
|
| +
|
| +TEST(ParseTree, Integers) {
|
| + static const char* const kGood[] = {
|
| + "0",
|
| + "10",
|
| + "-54321",
|
| + "9223372036854775807", // INT64_MAX
|
| + "-9223372036854775808", // INT64_MIN
|
| + };
|
| + for (auto s : kGood) {
|
| + TestParseInput input(std::string("x = ") + s);
|
| + EXPECT_FALSE(input.has_error());
|
| +
|
| + TestWithScope setup;
|
| + Err err;
|
| + input.parsed()->Execute(setup.scope(), &err);
|
| + EXPECT_FALSE(err.has_error());
|
| + }
|
| +
|
| + static const char* const kBad[] = {
|
| + "-0",
|
| + "010",
|
| + "-010",
|
| + "9223372036854775808", // INT64_MAX + 1
|
| + "-9223372036854775809", // INT64_MIN - 1
|
| + };
|
| + for (auto s : kBad) {
|
| + TestParseInput input(std::string("x = ") + s);
|
| + EXPECT_FALSE(input.has_error());
|
| +
|
| + TestWithScope setup;
|
| + Err err;
|
| + input.parsed()->Execute(setup.scope(), &err);
|
| + EXPECT_TRUE(err.has_error());
|
| + }
|
| +}
|
|
|