Update tests

Unit tests are not run on external segments. When external segments are
moved out of the core repo the extra test code won't be needed.
This commit is contained in:
Kim Silkebækken 2013-08-20 16:48:49 +02:00
parent e19a63aaa9
commit 74d4ee9669
2 changed files with 14 additions and 2 deletions

View File

@ -19,9 +19,16 @@ class TestConfig(TestCase):
def test_vim(self):
from powerline.vim import VimPowerline
cfg_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'powerline', 'config_files')
buffers = ((('bufoptions',), {'buftype': 'help'}), (('bufname', '[Command Line]'), {}), (('bufoptions',), {'buftype': 'quickfix'}))
buffers = (
(('bufoptions',), {'buftype': 'help'}),
(('bufname', '[Command Line]'), {}),
(('bufoptions',), {'buftype': 'quickfix'}),
)
with open(os.path.join(cfg_path, 'config.json'), 'r') as f:
self.assertEqual(len(buffers), len(json.load(f)['ext']['vim']['local_themes']))
local_themes_raw = json.load(f)['ext']['vim']['local_themes']
# Don't run tests on external/plugin segments
local_themes = dict((k, v) for (k, v) in local_themes_raw.items() if not '.' in k)
self.assertEqual(len(buffers), len(local_themes))
outputs = {}
i = 0

View File

@ -156,6 +156,9 @@ def command(cmd):
elif cmd.startswith('hi '):
sp = cmd.split()
_highlights[sp[1]] = sp[2:]
elif cmd.startswith('function! Powerline_plugin_ctrlp'):
# Ignore CtrlP updating functions
pass
else:
raise NotImplementedError
@ -169,6 +172,8 @@ def eval(expr):
elif expr.startswith('PowerlineRegisterCachePurgerEvent'):
_buf_purge_events.add(expr[expr.find('"') + 1:expr.rfind('"') - 1])
return "0"
elif expr.startswith('exists('):
return '0'
raise NotImplementedError