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

Side by Side Diff: tools/gn/parse_tree_unittest.cc

Issue 1549203002: Switch to standard integer types in tools/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 unified diff | Download patch
« no previous file with comments | « tools/gn/parse_tree.cc ('k') | tools/gn/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h>
6
5 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/input_file.h" 8 #include "tools/gn/input_file.h"
7 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/scope.h" 10 #include "tools/gn/scope.h"
9 #include "tools/gn/test_with_scope.h" 11 #include "tools/gn/test_with_scope.h"
10 12
11 TEST(ParseTree, Accessor) { 13 TEST(ParseTree, Accessor) {
12 TestWithScope setup; 14 TestWithScope setup;
13 15
14 // Make a pretend parse node with proper tracking that we can blame for the 16 // Make a pretend parse node with proper tracking that we can blame for the
(...skipping 18 matching lines...) Expand all
33 // Define a as a Scope. It should still fail because b isn't defined. 35 // Define a as a Scope. It should still fail because b isn't defined.
34 err = Err(); 36 err = Err();
35 setup.scope()->SetValue( 37 setup.scope()->SetValue(
36 "a", Value(nullptr, scoped_ptr<Scope>(new Scope(setup.scope()))), 38 "a", Value(nullptr, scoped_ptr<Scope>(new Scope(setup.scope()))),
37 nullptr); 39 nullptr);
38 result = accessor.Execute(setup.scope(), &err); 40 result = accessor.Execute(setup.scope(), &err);
39 EXPECT_TRUE(err.has_error()); 41 EXPECT_TRUE(err.has_error());
40 EXPECT_EQ(Value::NONE, result.type()); 42 EXPECT_EQ(Value::NONE, result.type());
41 43
42 // Define b, accessor should succeed now. 44 // Define b, accessor should succeed now.
43 const int64 kBValue = 42; 45 const int64_t kBValue = 42;
44 err = Err(); 46 err = Err();
45 setup.scope() 47 setup.scope()
46 ->GetMutableValue("a", false) 48 ->GetMutableValue("a", false)
47 ->scope_value() 49 ->scope_value()
48 ->SetValue("b", Value(nullptr, kBValue), nullptr); 50 ->SetValue("b", Value(nullptr, kBValue), nullptr);
49 result = accessor.Execute(setup.scope(), &err); 51 result = accessor.Execute(setup.scope(), &err);
50 EXPECT_FALSE(err.has_error()); 52 EXPECT_FALSE(err.has_error());
51 ASSERT_EQ(Value::INTEGER, result.type()); 53 ASSERT_EQ(Value::INTEGER, result.type());
52 EXPECT_EQ(kBValue, result.int_value()); 54 EXPECT_EQ(kBValue, result.int_value());
53 } 55 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 for (auto s : kBad) { 243 for (auto s : kBad) {
242 TestParseInput input(std::string("x = ") + s); 244 TestParseInput input(std::string("x = ") + s);
243 EXPECT_FALSE(input.has_error()); 245 EXPECT_FALSE(input.has_error());
244 246
245 TestWithScope setup; 247 TestWithScope setup;
246 Err err; 248 Err err;
247 input.parsed()->Execute(setup.scope(), &err); 249 input.parsed()->Execute(setup.scope(), &err);
248 EXPECT_TRUE(err.has_error()); 250 EXPECT_TRUE(err.has_error());
249 } 251 }
250 } 252 }
OLDNEW
« no previous file with comments | « tools/gn/parse_tree.cc ('k') | tools/gn/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698