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

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

Issue 2940873002: Implement tracking of BUILD.gn files used to define target, toolchain or (Closed)
Patch Set: Fix compilation after rebase. Created 3 years, 5 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/setup.cc ('k') | tools/gn/substitution_writer_unittest.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 "tools/gn/string_utils.h" 5 #include "tools/gn/string_utils.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"
11 #include "tools/gn/err.h" 11 #include "tools/gn/err.h"
12 #include "tools/gn/scope.h" 12 #include "tools/gn/scope.h"
13 #include "tools/gn/settings.h" 13 #include "tools/gn/settings.h"
14 #include "tools/gn/token.h" 14 #include "tools/gn/token.h"
15 #include "tools/gn/value.h" 15 #include "tools/gn/value.h"
16 16
17 namespace { 17 namespace {
18 18
19 bool CheckExpansionCase(const char* input, const char* expected, bool success) { 19 bool CheckExpansionCase(const char* input, const char* expected, bool success) {
20 Scope scope(static_cast<const Settings*>(nullptr)); 20 Scope scope(static_cast<const Settings*>(nullptr), {});
21 int64_t one = 1; 21 int64_t one = 1;
22 scope.SetValue("one", Value(nullptr, one), nullptr); 22 scope.SetValue("one", Value(nullptr, one), nullptr);
23 scope.SetValue("onestring", Value(nullptr, "one"), nullptr); 23 scope.SetValue("onestring", Value(nullptr, "one"), nullptr);
24 24
25 // Nested scope called "onescope" with a value "one" inside it. 25 // Nested scope called "onescope" with a value "one" inside it.
26 std::unique_ptr<Scope> onescope( 26 std::unique_ptr<Scope> onescope(
27 new Scope(static_cast<const Settings*>(nullptr))); 27 new Scope(static_cast<const Settings*>(nullptr), {}));
28 onescope->SetValue("one", Value(nullptr, one), nullptr); 28 onescope->SetValue("one", Value(nullptr, one), nullptr);
29 scope.SetValue("onescope", Value(nullptr, std::move(onescope)), nullptr); 29 scope.SetValue("onescope", Value(nullptr, std::move(onescope)), nullptr);
30 30
31 // List called "onelist" with one value that maps to 1. 31 // List called "onelist" with one value that maps to 1.
32 Value onelist(nullptr, Value::LIST); 32 Value onelist(nullptr, Value::LIST);
33 onelist.list_value().push_back(Value(nullptr, one)); 33 onelist.list_value().push_back(Value(nullptr, one));
34 scope.SetValue("onelist", onelist, nullptr); 34 scope.SetValue("onelist", onelist, nullptr);
35 35
36 // Construct the string token, which includes the quotes. 36 // Construct the string token, which includes the quotes.
37 std::string literal_string; 37 std::string literal_string;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 words.push_back("won\'t"); 146 words.push_back("won\'t");
147 words.push_back("help"); 147 words.push_back("help");
148 words.push_back("you"); 148 words.push_back("you");
149 words.push_back("now"); 149 words.push_back("now");
150 150
151 EXPECT_EQ("help", SpellcheckString("halp", words)); 151 EXPECT_EQ("help", SpellcheckString("halp", words));
152 152
153 // barbados has an edit distance of 4 from bravado, so there's no suggestion. 153 // barbados has an edit distance of 4 from bravado, so there's no suggestion.
154 EXPECT_TRUE(SpellcheckString("barbados", words).empty()); 154 EXPECT_TRUE(SpellcheckString("barbados", words).empty());
155 } 155 }
OLDNEW
« no previous file with comments | « tools/gn/setup.cc ('k') | tools/gn/substitution_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698