diff --git a/.travis.yml b/.travis.yml index c539596..1a83b2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,6 @@ python: - "3.6" - "pypy" # PyPy2 2.5.0 - "pypy3" # Pypy3 2.4.0 -script: python -m tests +script: + - pip install -r nearley-requirements.txt + - python -m tests diff --git a/tests/test_parser.py b/tests/test_parser.py index 3799fce..fc66936 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from __future__ import absolute_import import unittest @@ -875,6 +876,22 @@ def _make_parser_test(LEXER, PARSER): self.assertEqual(''.join(child.data for child in res.children), 'indirection') + def test_utf8(self): + g = u"""start: a + a: "±a" + """ + l = _Lark(g) + self.assertEqual(l.parse(u'±a'), Tree('start', [Tree('a', [])])) + + g = u"""start: A + A: "±a" + """ + l = _Lark(g) + self.assertEqual(l.parse(u'±a'), Tree('start', [u'\xb1a'])) + + + + _NAME = "Test" + PARSER.capitalize() + (LEXER or 'Scanless').capitalize() _TestParser.__name__ = _NAME globals()[_NAME] = _TestParser