Improve support for 'type/subtype+suffix' mime types in the colors output formatter.

E.g.:
* application/ld+json
* application/hal+json

Closes #189, #206
This commit is contained in:
Jakub Roztocil
2014-04-28 10:08:03 +02:00
parent 76ab8b84be
commit faec00fd99
3 changed files with 109 additions and 90 deletions

View File

@@ -29,15 +29,17 @@ class TestVerboseFlag:
class TestColors:
@pytest.mark.parametrize('mime', [
'text/html',
'foo/html',
'text/html+foo',
'text/foo+html'
'application/json',
'application/json+foo',
'application/foo+json',
'foo/json',
'foo/json+bar',
'foo/bar+json',
])
def test_get_lexer(self, mime):
lexer = get_lexer(mime)
assert lexer is not None
assert lexer.name == 'HTML'
assert lexer.name == 'JSON'
def test_get_lexer_not_found(self):
assert get_lexer('xxx/yyy') is None