Commit 821bdb8f authored by Taddeus Kroes's avatar Taddeus Kroes

Added test for unary operator parentheses.

parent 5a1d45ef
...@@ -36,6 +36,10 @@ class TestLine(unittest.TestCase): ...@@ -36,6 +36,10 @@ class TestLine(unittest.TestCase):
exp = N('*', N('/', N('*', a, b), c), d) exp = N('*', N('/', N('*', a, b), c), d)
self.assertEquals(generate_line(exp), 'ab / c * d') self.assertEquals(generate_line(exp), 'ab / c * d')
def test_parentheses_unary(self):
neg = N('-', N('+', L(1), L(2)))
self.assertEquals(generate_line(neg), '-(1 + 2)')
def test_parentheses_nary(self): def test_parentheses_nary(self):
l0, l1, l2 = L(1), L(2), L(3) l0, l1, l2 = L(1), L(2), L(3)
plus = N('+', N('+', l0, l1), l2) plus = N('+', N('+', l0, l1), l2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment