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 bb3dca421b8c3a05a66e9ae62d2d971ddc1a8e36..63aa5e1832773863ebcfdadd3424e1a052ee7a45 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): |
@@ -225,6 +232,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') |
+ |
+ 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')) |