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

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

Issue 1631873003: Check system-include dependencies in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/c_include_iterator.cc ('k') | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "tools/gn/c_include_iterator.h" 8 #include "tools/gn/c_include_iterator.h"
9 #include "tools/gn/input_file.h" 9 #include "tools/gn/input_file.h"
10 #include "tools/gn/location.h" 10 #include "tools/gn/location.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 CIncludeIterator iter(&file); 43 CIncludeIterator iter(&file);
44 44
45 base::StringPiece contents; 45 base::StringPiece contents;
46 LocationRange range; 46 LocationRange range;
47 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); 47 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range));
48 EXPECT_EQ("foo/bar.h", contents); 48 EXPECT_EQ("foo/bar.h", contents);
49 EXPECT_TRUE(RangeIs(range, 3, 11, 20)) << range.begin().Describe(true); 49 EXPECT_TRUE(RangeIs(range, 3, 11, 20)) << range.begin().Describe(true);
50 50
51 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); 51 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range));
52 EXPECT_EQ("stdio.h", contents);
53 EXPECT_TRUE(RangeIs(range, 5, 11, 18)) << range.begin().Describe(true);
54
55 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range));
52 EXPECT_EQ("foo/baz.h", contents); 56 EXPECT_EQ("foo/baz.h", contents);
53 EXPECT_TRUE(RangeIs(range, 7, 12, 21)) << range.begin().Describe(true); 57 EXPECT_TRUE(RangeIs(range, 7, 12, 21)) << range.begin().Describe(true);
54 58
55 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); 59 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range));
56 EXPECT_EQ("la/deda.h", contents); 60 EXPECT_EQ("la/deda.h", contents);
57 EXPECT_TRUE(RangeIs(range, 8, 11, 20)) << range.begin().Describe(true); 61 EXPECT_TRUE(RangeIs(range, 8, 11, 20)) << range.begin().Describe(true);
58 62
59 // The line annotated with "nogncheck" should be skipped. 63 // The line annotated with "nogncheck" should be skipped.
60 64
61 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); 65 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 InputFile file(SourceFile("//foo.cc")); 154 InputFile file(SourceFile("//foo.cc"));
151 file.SetContents(buffer); 155 file.SetContents(buffer);
152 156
153 base::StringPiece contents; 157 base::StringPiece contents;
154 LocationRange range; 158 LocationRange range;
155 159
156 CIncludeIterator iter(&file); 160 CIncludeIterator iter(&file);
157 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); 161 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range));
158 EXPECT_EQ("foo/bar.h", contents); 162 EXPECT_EQ("foo/bar.h", contents);
159 } 163 }
OLDNEW
« no previous file with comments | « tools/gn/c_include_iterator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698