diff --git a/luaparser/tests/test_integration.py b/luaparser/tests/test_integration.py index 76c4636..e8b5594 100644 --- a/luaparser/tests/test_integration.py +++ b/luaparser/tests/test_integration.py @@ -194,13 +194,13 @@ def test_cont_int_5(self): tree = ast.parse( textwrap.dedent( """ - function table.pack(...) - repeat - print("value of a:", a) - a = a + 1; - until( a > 15 ) - end - """ + function table.pack(...) + repeat + print("value of a:", a) + a = a + 1; + until( a > 15 ) + end + """ ) ) nodes = ast.walk(tree) @@ -291,4 +291,24 @@ def test_cont_int_7(self): # Brackets are absent in output of AST->source_code conversion #57 def test_cont_int_8(self): source = r"result = (a + b) / (c + d)" - self.assertEqual(source, ast.to_lua_source(ast.parse(source))) \ No newline at end of file + self.assertEqual(source, ast.to_lua_source(ast.parse(source))) + + # Failure to parse chained comparisons #56 + def test_cont_int_9(self): + tree = ast.parse(textwrap.dedent(""" + if false == false == false then + x = 2 + end + """)) + exp = Chunk( + Block([ + If( + test=EqToOp(left=EqToOp(left=FalseExpr(), right=FalseExpr()), right=FalseExpr()), + body=Block([ + Assign([Name("x")], [Number(2)]) + ]), + orelse=None, + ) + ]) + ) + self.assertEqual(exp, tree)