OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Tests for chromium.ycm_extra_conf. | 7 """Tests for chromium.ycm_extra_conf. |
8 | 8 |
9 These tests should be getting picked up by the PRESUBMIT.py in /tools/vim. | 9 These tests should be getting picked up by the PRESUBMIT.py in /tools/vim. |
10 Currently the tests only run on Linux and require 'ninja' to be available on | 10 Currently the tests only run on Linux and require 'ninja' to be available on |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 self.chrome_root, os.path.join(self.chrome_root, 'one.cpp')) | 156 self.chrome_root, os.path.join(self.chrome_root, 'one.cpp')) |
157 self.assertEquals(self.NormalizeStringsInList(clang_options), [ | 157 self.assertEquals(self.NormalizeStringsInList(clang_options), [ |
158 '-I[SRC]', | 158 '-I[SRC]', |
159 '-Wno-unknown-warning-option', | 159 '-Wno-unknown-warning-option', |
160 '-I[OUT]/a', | 160 '-I[OUT]/a', |
161 '-isysroot', | 161 '-isysroot', |
162 '/mac.sdk', | 162 '/mac.sdk', |
163 '-I[OUT]/tag-one' | 163 '-I[OUT]/tag-one' |
164 ]) | 164 ]) |
165 | 165 |
| 166 def testOutDirNames(self): |
| 167 out_root = os.path.join(self.chrome_root, 'out_with_underscore') |
| 168 out_dir = os.path.join(out_root, 'Debug') |
| 169 shutil.move(os.path.join(self.chrome_root, 'out'), |
| 170 out_root) |
| 171 |
| 172 clang_options = \ |
| 173 self.ycm_extra_conf.GetClangOptionsFromNinjaForFilename( |
| 174 self.chrome_root, os.path.join(self.chrome_root, 'one.cpp')) |
| 175 self.assertIn('-I%s/a' % out_dir, clang_options) |
| 176 self.assertIn('-I%s/tag-one' % out_dir, clang_options) |
| 177 |
166 def testGetFlagsForFileForKnownCppFile(self): | 178 def testGetFlagsForFileForKnownCppFile(self): |
167 result = self.ycm_extra_conf.FlagsForFile( | 179 result = self.ycm_extra_conf.FlagsForFile( |
168 os.path.join(self.chrome_root, 'one.cpp')) | 180 os.path.join(self.chrome_root, 'one.cpp')) |
169 self.assertTrue(result) | 181 self.assertTrue(result) |
170 self.assertTrue('do_cache' in result) | 182 self.assertTrue('do_cache' in result) |
171 self.assertTrue(result['do_cache']) | 183 self.assertTrue(result['do_cache']) |
172 self.assertTrue('flags' in result) | 184 self.assertTrue('flags' in result) |
173 self.assertEquals(self.NormalizeStringsInList(result['flags']), [ | 185 self.assertEquals(self.NormalizeStringsInList(result['flags']), [ |
174 '-DUSE_CLANG_COMPLETER', | 186 '-DUSE_CLANG_COMPLETER', |
175 '-std=c++11', | 187 '-std=c++11', |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 '-I[SRC]', | 297 '-I[SRC]', |
286 '-Wno-unknown-warning-option', | 298 '-Wno-unknown-warning-option', |
287 '-I[OUT]/a', | 299 '-I[OUT]/a', |
288 '-isysroot', | 300 '-isysroot', |
289 '/mac.sdk', | 301 '/mac.sdk', |
290 '-I[OUT]/tag-default' | 302 '-I[OUT]/tag-default' |
291 ]) | 303 ]) |
292 | 304 |
293 if __name__ == '__main__': | 305 if __name__ == '__main__': |
294 unittest.main() | 306 unittest.main() |
OLD | NEW |