Add testcase for #1860

This commit is contained in:
Takeshi KOMIYA 2016-01-08 16:00:26 +09:00
parent c6c9c5c264
commit 23eb0e24fc
2 changed files with 27 additions and 0 deletions

View File

@ -29,6 +29,7 @@ try:
except ImportError:
native_module = False
from sphinx.errors import SphinxError
from sphinx.search import SearchLanguage
@ -49,10 +50,14 @@ class MecabBinder(object):
else:
result = self.ctypes_libmecab.mecab_sparse_tostr(
self.ctypes_mecab, input.encode(self.dict_encode))
if result is None:
raise SphinxError('Failed to tokenize text:\nMecab: %s\nInput:\n%s' %
(self.ctypes_mecab, input))
if PY3:
return result.split(' ')
else:
return result.decode(self.dict_encode).split(' ')
return result.decode(self.dict_encode).split(' ')
def init_native(self, options):
param = '-Owakati'

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
"""
test_build_manpage
~~~~~~~~~~~~~~~~~~
Test the build process with manpage builder with the test root.
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
from util import with_app
@with_app(buildername='man')
def test_all(app, status, warning):
app.builder.build_all()
assert (app.outdir / 'SphinxTests.1').exists()
content = (app.outdir / 'SphinxTests.1').text()
assert r'\fBprint \fP\fIi\fP\fB\en\fP' in content