[theme] Add unit tests for WAL loading
This commit is contained in:
parent
18ea6d36d1
commit
2a93a001b2
2 changed files with 23 additions and 7 deletions
|
@ -25,6 +25,9 @@ class theme(unittest.TestCase):
|
|||
'red': '#ff0000', 'blue': '#0000ff'
|
||||
}]
|
||||
}
|
||||
self.walTheme = {
|
||||
'colors': ['wal']
|
||||
}
|
||||
|
||||
def test_invalid_theme(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
|
@ -69,4 +72,22 @@ class theme(unittest.TestCase):
|
|||
theme = core.theme.Theme(raw_data=self.colorTheme)
|
||||
self.assertEqual(self.colorTheme['colors'][0], theme.keywords())
|
||||
|
||||
def test_wal_colors(self):
|
||||
with unittest.mock.patch('core.theme.io') as io:
|
||||
io.open.return_value.__enter__.return_value.read.return_value='''
|
||||
{ "colors": { "red": "#ff0000" } }
|
||||
'''
|
||||
|
||||
theme = core.theme.Theme(raw_data=self.walTheme)
|
||||
self.assertEqual({'red': '#ff0000'}, theme.keywords())
|
||||
|
||||
def test_wal_special(self):
|
||||
with unittest.mock.patch('core.theme.io') as io:
|
||||
io.open.return_value.__enter__.return_value.read.return_value='''
|
||||
{ "special": { "background": "#ff0000" } }
|
||||
'''
|
||||
|
||||
theme = core.theme.Theme(raw_data=self.walTheme)
|
||||
self.assertEqual({'background': '#ff0000'}, theme.keywords())
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue