| 1 |
""" |
| 2 |
Tests for the vim modeline feature |
| 3 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4 |
|
| 5 |
:copyright: Copyright 2006-present by the Pygments team, see AUTHORS. |
| 6 |
:license: BSD, see LICENSE for details. |
| 7 |
""" |
| 8 |
|
| 9 |
from pygments import modeline |
| 10 |
|
| 11 |
|
| 12 |
def test_modelines(): |
| 13 |
for buf in [ |
| 14 |
'vi: ft=python' + '\n' * 8, |
| 15 |
'vi: ft=python' + '\n' * 8, |
| 16 |
'\n\n\n\nvi=8: syntax=python' + '\n' * 8, |
| 17 |
'\n' * 8 + 'ex: filetype=python', |
| 18 |
'\n' * 8 + 'vim: some,other,syn=python\n\n\n\n' |
| 19 |
]: |
| 20 |
assert modeline.get_filetype_from_buffer(buf) == 'python' |