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

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

Issue 1525183002: tools/gn: rename char_offset to column_number (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix indentation Created 5 years 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 | « no previous file | tools/gn/err.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 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "tools/gn/c_include_iterator.h" 6 #include "tools/gn/c_include_iterator.h"
7 #include "tools/gn/input_file.h" 7 #include "tools/gn/input_file.h"
8 #include "tools/gn/location.h" 8 #include "tools/gn/location.h"
9 9
10 namespace { 10 namespace {
11 11
12 bool RangeIs(const LocationRange& range, 12 bool RangeIs(const LocationRange& range,
13 int line, int begin_char, int end_char) { 13 int line, int begin_char, int end_char) {
14 return range.begin().line_number() == line && 14 return range.begin().line_number() == line &&
15 range.end().line_number() == line && 15 range.end().line_number() == line &&
16 range.begin().char_offset() == begin_char && 16 range.begin().column_number() == begin_char &&
17 range.end().char_offset() == end_char; 17 range.end().column_number() == end_char;
18 } 18 }
19 19
20 } // namespace 20 } // namespace
21 21
22 TEST(CIncludeIterator, Basic) { 22 TEST(CIncludeIterator, Basic) {
23 std::string buffer; 23 std::string buffer;
24 buffer.append("// Some comment\n"); 24 buffer.append("// Some comment\n");
25 buffer.append("\n"); 25 buffer.append("\n");
26 buffer.append("#include \"foo/bar.h\"\n"); 26 buffer.append("#include \"foo/bar.h\"\n");
27 buffer.append("\n"); 27 buffer.append("\n");
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 InputFile file(SourceFile("//foo.cc")); 148 InputFile file(SourceFile("//foo.cc"));
149 file.SetContents(buffer); 149 file.SetContents(buffer);
150 150
151 base::StringPiece contents; 151 base::StringPiece contents;
152 LocationRange range; 152 LocationRange range;
153 153
154 CIncludeIterator iter(&file); 154 CIncludeIterator iter(&file);
155 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); 155 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range));
156 EXPECT_EQ("foo/bar.h", contents); 156 EXPECT_EQ("foo/bar.h", contents);
157 } 157 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/err.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698