Skip to content

Commit 6369477

Browse files
refactor(test): Move test_empty_expr.py into test_treegen.py
1 parent 20ae779 commit 6369477

File tree

4 files changed

+38
-50
lines changed

4 files changed

+38
-50
lines changed

test/test_cstgen/.snapshots/test_empty_expr.txt

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

test/test_cstgen/.snapshots/test_treegen.txt

Lines changed: 15 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_empty_expr.py

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

test/test_cstgen/test_treegen.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,28 @@ def test_getitem__issue_09(self):
118118
self.assertMatchesSnapshot(node, 'after_string')
119119

120120

121+
class TestEmptyExpr(CommonTestCase):
122+
def test_error_empty_assign_source(self):
123+
t = Tokenizer('let a= ;').tokenize()
124+
with self.assertRaises(LocatedCstError) as err:
125+
CstGen(t).parse()
126+
self.assertBetweenIncl(5, 7, err.exception.region.start)
127+
self.assertBetweenIncl(7, 8, err.exception.region.end)
128+
self.assertContains(str(err.exception), "semi")
129+
130+
def test_error_empty_condition(self):
131+
t = Tokenizer('if {x();}').tokenize()
132+
with self.assertRaises(LocatedCstError) as err:
133+
CstGen(t).parse()
134+
self.assertBetweenIncl(0, 3, err.exception.region.start)
135+
self.assertBetweenIncl(2, 4, err.exception.region.end)
136+
self.assertContains(str(err.exception), "brace")
137+
138+
def test_empty_expr_issue_04(self):
139+
t = Tokenizer('let a=9;;').tokenize()
140+
node = CstGen(t).parse()
141+
self.assertMatchesSnapshot(node)
142+
143+
121144
if __name__ == '__main__':
122145
unittest.main()

0 commit comments

Comments
 (0)