| OLD | NEW |
| 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> |
| 6 |
| 5 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "tools/gn/c_include_iterator.h" | 8 #include "tools/gn/c_include_iterator.h" |
| 7 #include "tools/gn/input_file.h" | 9 #include "tools/gn/input_file.h" |
| 8 #include "tools/gn/location.h" | 10 #include "tools/gn/location.h" |
| 9 | 11 |
| 10 namespace { | 12 namespace { |
| 11 | 13 |
| 12 bool RangeIs(const LocationRange& range, | 14 bool RangeIs(const LocationRange& range, |
| 13 int line, int begin_char, int end_char) { | 15 int line, int begin_char, int end_char) { |
| 14 return range.begin().line_number() == line && | 16 return range.begin().line_number() == line && |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 InputFile file(SourceFile("//foo.cc")); | 150 InputFile file(SourceFile("//foo.cc")); |
| 149 file.SetContents(buffer); | 151 file.SetContents(buffer); |
| 150 | 152 |
| 151 base::StringPiece contents; | 153 base::StringPiece contents; |
| 152 LocationRange range; | 154 LocationRange range; |
| 153 | 155 |
| 154 CIncludeIterator iter(&file); | 156 CIncludeIterator iter(&file); |
| 155 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); | 157 EXPECT_TRUE(iter.GetNextIncludeString(&contents, &range)); |
| 156 EXPECT_EQ("foo/bar.h", contents); | 158 EXPECT_EQ("foo/bar.h", contents); |
| 157 } | 159 } |
| OLD | NEW |