Chromium Code Reviews| 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..51b88f037116f1434ed091568e28e91578aa8a75 100644 |
| --- a/tools/gn/parse_tree_unittest.cc |
| +++ b/tools/gn/parse_tree_unittest.cc |
| @@ -212,3 +212,41 @@ TEST(ParseTree, SortRangeExtraction) { |
| EXPECT_EQ(3u, ranges[0].end); |
| } |
| } |
| + |
| +TEST(ParseTree, Integers) { |
| + const char *good[] = { |
| + "0", |
| + "10", |
| + "-54321", |
| + "9223372036854775807", |
| + "-9223372036854775808", |
| + }; |
| + |
| + const char *bad[] = { |
|
brettw
2015/03/31 23:05:33
I think it would be better to move this to right a
mdempsky
2015/03/31 23:19:20
Done.
|
| + "-0", |
| + "010", |
| + "-010", |
| + "9223372036854775808", |
| + "-9223372036854775809", |
| + }; |
| + |
| + for (auto s : good) { |
| + 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()); |
| + } |
| + |
| + for (auto s : bad) { |
| + 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()); |
| + } |
| +} |