From 0538b980aee09e59bc6c21b121cf1c6670e73cc5 Mon Sep 17 00:00:00 2001 From: apalala Date: Wed, 11 Oct 2023 11:00:06 -0400 Subject: [PATCH] [test] add unit test on advancing over whitespace --- test/parsing_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parsing_test.py b/test/parsing_test.py index 00f446f0..5c8a5a98 100644 --- a/test/parsing_test.py +++ b/test/parsing_test.py @@ -1,9 +1,10 @@ # -*- coding: utf-8 -*- +import json import unittest import tempfile import tatsu -from tatsu.util import trim, eval_escapes +from tatsu.util import trim, eval_escapes, asjson from tatsu.grammars import EBNFBuffer @@ -122,7 +123,8 @@ def test_skip_whitespace(self): id = /[a-z]+/ ; ''' model = tatsu.compile(grammar=grammar) - ast = model.parse('FOO bar', parseinfo=True) + ast = model.parse('FOO' + ' ' * 3 + 'bar', parseinfo=True) + print(json.dumps(asjson(ast), indent=2)) subject = ast[1] assert subject['name'] == 'bar' parseinfo = subject['parseinfo']