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 63aa5e1832773863ebcfdadd3424e1a052ee7a45..3443fa3c553f54ec0cec8e7432e6f4896f7c4696 100755 |
--- a/tools/vim/tests/chromium.ycm_extra_conf_unittest.py |
+++ b/tools/vim/tests/chromium.ycm_extra_conf_unittest.py |
@@ -60,6 +60,14 @@ def GetLastLangFlag(flags): |
lastLang = flags[i+1] |
return lastLang |
+def TestLanguage(test_file, language): |
+ def test(self): |
+ result = self.ycm_extra_conf.FlagsForFile( |
+ os.path.join(self.chrome_root, test_file)) |
+ self.assertTrue(result) |
+ self.assertEqual(GetLastLangFlag(result['flags']), language) |
+ return test |
+ |
class Chromium_ycmExtraConfTest(unittest.TestCase): |
def SetUpFakeChromeTreeBelowPath(self): |
@@ -232,17 +240,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++') |
+ testGetFlagsForFileForKnownObjcFile = TestLanguage( |
+ 'eight.m', 'objective-c') |
+ testGetFlagsForFileForKnownObjcHeaderFile = TestLanguage( |
+ 'eight.h', 'objective-c') |
+ testGetFlagsForFileForUnknownObjcFile = TestLanguage( |
+ 'nonexistent.m', 'objective-c') |
+ testGetFlagsForFileForKnownObjcppFile = TestLanguage( |
+ 'nine.mm', 'objective-c++') |
+ testGetFlagsForFileForKnownObjcppHeaderFile = TestLanguage( |
+ 'nine.h', 'objective-c++') |
+ testGetFlagsForFileForUnknownObjcppFile = TestLanguage( |
+ 'nonexistent.mm', 'objective-c++') |
def testGetFlagsForFileForUnknownHeaderFile(self): |
result = self.ycm_extra_conf.FlagsForFile( |