Skip to content

Commit 20ae779

Browse files
refactor(test): Move test_parse_expr_pass_0.py into test_treegen.py
(The _parse_expr_pass_0 method, after which it was named, doesn't even exist any more)
1 parent d84f2f1 commit 20ae779

File tree

4 files changed

+86
-97
lines changed

4 files changed

+86
-97
lines changed

test/test_cstgen/.snapshots/test_parse_expr_pass_0.txt

Lines changed: 0 additions & 61 deletions
This file was deleted.

test/test_cstgen/.snapshots/test_treegen.txt

Lines changed: 61 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test_cstgen/test_parse_expr_pass_0.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

test/test_cstgen/test_treegen.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

33
from parser.lexer.tokenizer import Tokenizer
4-
from parser.cst.treegen import TreeGen, LocatedCstError
4+
from parser.cst.treegen import TreeGen, LocatedCstError, CstGen
55
from parser.common import StrRegion
66
from test.common import CommonTestCase
77

@@ -94,5 +94,29 @@ def test_empty_sqb_error(self):
9494
self.assertEqual(4, exc.region.end - 1)
9595

9696

97+
class TestItemChain(CommonTestCase):
98+
def test_getattr__issue_09(self):
99+
t = Tokenizer('fn(call_arg).a;').tokenize()
100+
node = CstGen(t).parse()
101+
self.assertMatchesSnapshot(node, 'after_call')
102+
t = Tokenizer('(paren + x).b;').tokenize()
103+
node = CstGen(t).parse()
104+
self.assertMatchesSnapshot(node, 'after_paren')
105+
t = Tokenizer('"a string".b;').tokenize()
106+
node = CstGen(t).parse()
107+
self.assertMatchesSnapshot(node, 'after_string')
108+
109+
def test_getitem__issue_09(self):
110+
t = Tokenizer('fn(call_arg)[1];').tokenize()
111+
node = CstGen(t).parse()
112+
self.assertMatchesSnapshot(node, 'after_call')
113+
t = Tokenizer('(paren + x)[2];').tokenize()
114+
node = CstGen(t).parse()
115+
self.assertMatchesSnapshot(node, 'after_paren')
116+
t = Tokenizer('"a string"["key_" .. 3];').tokenize()
117+
node = CstGen(t).parse()
118+
self.assertMatchesSnapshot(node, 'after_string')
119+
120+
97121
if __name__ == '__main__':
98122
unittest.main()

0 commit comments

Comments
 (0)