Commits

Michał Górny  committed 53f8d4a

Add doctests for current use cases.

  • Participants
  • Parent commits 9f92b76

Comments (0)

Files changed (1)

File pymodeline/__init__.py

 # (c) 2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
+"""
+Vim modeline parsing module.
+
+>>> from pprint import pprint
+>>> p = ModelineParser()
+>>> pprint(p.parse_line('// vi:syntax=perl:fileencoding=utf8'))
+{'fileencoding': 'utf8', 'syntax': 'perl'}
+>>> pprint(p.parse_line('vi:syntax=perl'))
+{'syntax': 'perl'}
+>>> pprint(p.parse_line('# ex:syntax=perl fileencoding=utf8:textwidth=40'))
+{'fileencoding': 'utf8', 'syntax': 'perl', 'textwidth': '40'}
+>>> pprint(p.parse_line('ex:syntax=perl'))
+{}
+>>> pprint(p.parse_line('#vim:syntax=python'))
+{}
+"""
+
 import re
 
 class ModelineParser(object):