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

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

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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/target_generator.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 scoped_ptr<Scope> onescope(new Scope(static_cast<const Settings*>(nullptr))); 26 std::unique_ptr<Scope> onescope(
27 new Scope(static_cast<const Settings*>(nullptr)));
27 onescope->SetValue("one", Value(nullptr, one), nullptr); 28 onescope->SetValue("one", Value(nullptr, one), nullptr);
28 scope.SetValue("onescope", Value(nullptr, std::move(onescope)), nullptr); 29 scope.SetValue("onescope", Value(nullptr, std::move(onescope)), nullptr);
29 30
30 // List called "onelist" with one value that maps to 1. 31 // List called "onelist" with one value that maps to 1.
31 Value onelist(nullptr, Value::LIST); 32 Value onelist(nullptr, Value::LIST);
32 onelist.list_value().push_back(Value(nullptr, one)); 33 onelist.list_value().push_back(Value(nullptr, one));
33 scope.SetValue("onelist", onelist, nullptr); 34 scope.SetValue("onelist", onelist, nullptr);
34 35
35 // Construct the string token, which includes the quotes. 36 // Construct the string token, which includes the quotes.
36 std::string literal_string; 37 std::string literal_string;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 words.push_back("won\'t"); 146 words.push_back("won\'t");
146 words.push_back("help"); 147 words.push_back("help");
147 words.push_back("you"); 148 words.push_back("you");
148 words.push_back("now"); 149 words.push_back("now");
149 150
150 EXPECT_EQ("help", SpellcheckString("halp", words)); 151 EXPECT_EQ("help", SpellcheckString("halp", words));
151 152
152 // 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.
153 EXPECT_TRUE(SpellcheckString("barbados", words).empty()); 154 EXPECT_TRUE(SpellcheckString("barbados", words).empty());
154 } 155 }
OLDNEW
« no previous file with comments | « tools/gn/string_utils.cc ('k') | tools/gn/target_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698