Chromium Code Reviews| Index: tools/vim/tests/chromium.ycm_extra_conf_unittest.py |
| diff --git a/tools/vim/tests/chromium.ycm_extra_conf_unittest.py b/tools/vim/tests/chromium.ycm_extra_conf_unittest.py |
| index bfaf8fae7435b0a1e7df592a9a369372ce41bfd0..f5fed54919f83aaa82fbd74d9202162b5093e073 100755 |
| --- a/tools/vim/tests/chromium.ycm_extra_conf_unittest.py |
| +++ b/tools/vim/tests/chromium.ycm_extra_conf_unittest.py |
| @@ -53,6 +53,13 @@ def CreateFile(path, |
| statinfo = os.stat(path) |
| os.chmod(path, statinfo.st_mode | stat.S_IXUSR) |
| +def GetLastLangFlag(flags): |
| + lastLang = None |
| + for i, flag in enumerate(flags): |
| + if flag =='-x': |
| + lastLang = flags[i+1] |
| + return lastLang |
| + |
| class Chromium_ycmExtraConfTest(unittest.TestCase): |
| def SetUpFakeChromeTreeBelowPath(self): |
| @@ -224,6 +231,18 @@ class Chromium_ycmExtraConfTest(unittest.TestCase): |
| '-I[OUT]/tag-default' |
| ]) |
| + def testGetFlagsForFileForUnknownObjcFile(self): |
| + result = self.ycm_extra_conf.FlagsForFile( |
| + os.path.join(self.chrome_root, 'nonexistent.m')) |
| + self.assertTrue(result) |
| + self.assertEqual(GetLastLangFlag(result['flags']), 'objective-c') |
|
asanka
2016/09/02 15:00:50
"-x objective-c" might not be the last flag since
Sidney San Martín
2016/09/02 15:07:07
It may not be the last flag, but it does need to b
|
| + |
| + def testGetFlagsForFileForUnknownObjcppFile(self): |
| + result = self.ycm_extra_conf.FlagsForFile( |
| + os.path.join(self.chrome_root, 'nonexistent.mm')) |
| + self.assertTrue(result) |
| + self.assertEqual(GetLastLangFlag(result['flags']), 'objective-c++') |
| + |
| def testGetFlagsForFileForUnknownHeaderFile(self): |
| result = self.ycm_extra_conf.FlagsForFile( |
| os.path.join(self.chrome_root, 'nonexistent.h')) |