Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Unified Diff: tools/vim/tests/chromium.ycm_extra_conf_unittest.py

Issue 2474243002: [Vim/YCM] Identify ObjC and ObjC++ headers. (Closed)
Patch Set: Use normal cxx for the new tests. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/vim/chromium.ycm_extra_conf.py ('k') | tools/vim/tests/data/fake_build_ninja.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « tools/vim/chromium.ycm_extra_conf.py ('k') | tools/vim/tests/data/fake_build_ninja.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698