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

Side by Side Diff: tools/gn/string_utils_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, 11 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/string_utils.cc ('k') | tools/gn/substitution_list.cc » ('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 (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 <stdint.h>
6
5 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/err.h" 8 #include "tools/gn/err.h"
7 #include "tools/gn/scope.h" 9 #include "tools/gn/scope.h"
8 #include "tools/gn/settings.h" 10 #include "tools/gn/settings.h"
9 #include "tools/gn/string_utils.h" 11 #include "tools/gn/string_utils.h"
10 #include "tools/gn/token.h" 12 #include "tools/gn/token.h"
11 #include "tools/gn/value.h" 13 #include "tools/gn/value.h"
12 14
13 namespace { 15 namespace {
14 16
15 bool CheckExpansionCase(const char* input, const char* expected, bool success) { 17 bool CheckExpansionCase(const char* input, const char* expected, bool success) {
16 Scope scope(static_cast<const Settings*>(nullptr)); 18 Scope scope(static_cast<const Settings*>(nullptr));
17 int64 one = 1; 19 int64_t one = 1;
18 scope.SetValue("one", Value(nullptr, one), nullptr); 20 scope.SetValue("one", Value(nullptr, one), nullptr);
19 scope.SetValue("onestring", Value(nullptr, "one"), nullptr); 21 scope.SetValue("onestring", Value(nullptr, "one"), nullptr);
20 22
21 // Nested scope called "onescope" with a value "one" inside it. 23 // Nested scope called "onescope" with a value "one" inside it.
22 scoped_ptr<Scope> onescope(new Scope(static_cast<const Settings*>(nullptr))); 24 scoped_ptr<Scope> onescope(new Scope(static_cast<const Settings*>(nullptr)));
23 onescope->SetValue("one", Value(nullptr, one), nullptr); 25 onescope->SetValue("one", Value(nullptr, one), nullptr);
24 scope.SetValue("onescope", Value(nullptr, onescope.Pass()), nullptr); 26 scope.SetValue("onescope", Value(nullptr, onescope.Pass()), nullptr);
25 27
26 // List called "onelist" with one value that maps to 1. 28 // List called "onelist" with one value that maps to 1.
27 Value onelist(nullptr, Value::LIST); 29 Value onelist(nullptr, Value::LIST);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 EXPECT_TRUE(CheckExpansionCase("hello #${onescope.two}", nullptr, false)); 92 EXPECT_TRUE(CheckExpansionCase("hello #${onescope.two}", nullptr, false));
91 93
92 // Accessing the list. 94 // Accessing the list.
93 EXPECT_TRUE(CheckExpansionCase("hello #${onelist[0]}", "hello #1", true)); 95 EXPECT_TRUE(CheckExpansionCase("hello #${onelist[0]}", "hello #1", true));
94 EXPECT_TRUE(CheckExpansionCase("hello #${onelist[1]}", nullptr, false)); 96 EXPECT_TRUE(CheckExpansionCase("hello #${onelist[1]}", nullptr, false));
95 97
96 // Trying some other (otherwise valid) expressions should fail. 98 // Trying some other (otherwise valid) expressions should fail.
97 EXPECT_TRUE(CheckExpansionCase("${1 + 2}", nullptr, false)); 99 EXPECT_TRUE(CheckExpansionCase("${1 + 2}", nullptr, false));
98 EXPECT_TRUE(CheckExpansionCase("${print(1)}", nullptr, false)); 100 EXPECT_TRUE(CheckExpansionCase("${print(1)}", nullptr, false));
99 } 101 }
OLDNEW
« no previous file with comments | « tools/gn/string_utils.cc ('k') | tools/gn/substitution_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698