# Test for implicit forms of line continuation: round brackets and trailing binary ops # ticket:211 (partially also addresses ticket 210) class Program def main .cond .stmtExpr def stmtExpr assert 1 + 2 == 3 # ok assert (1 + # braces ok 2) == 3 assert (1 + # braces ok 2) assert 1 * # implicit trailing '*', 0 indent 2 == 2 assert 1 + # implicit trailing '+', 1 indent 2 == 3 #assert (1 + # Ticket 210: Cannot mix tabs and spaces in indentation. # 2) #assert 1 + # Both tickets. # 2 == 3 assert (1 + # braces, double indent 12) == 13 assert 1 + # trailing '+', double indent after 2 == 3 assert 3 - # trailing '-', double indent after 2 == 1 assert 3 * # ((3*1) + 4) -(8/2) # multiple lines 1 + 4 - 8 / 2 == 3 a = 1 b = 2 assert (a == 1 and b == 2) assert a == 1 and #implicit on 'and' b == 2 assert a == 1 or # implicit on or b == 2 #assert a == 1 and # implicit on and and tabs+spaces # b == 2 def cond a=99 b=99 # expect these two to be the most common multiline condition indentation # 2nd and perhaps subsequent lines indented 1 or 2 indents if a > 98 and b == 99 assert true, 'OK - 1 indent' else assert false, 'fail' if a > 98 and b == 99 assert true, 'OK - 2 indents' else assert false, 'fail' if a > 98 and b == 99 or a == b assert true, 'OK - 1 indent' else assert false, 'fail' if a > 98 and b == 99 or a == b or b > 45 assert true, 'OK - 2 indents' else assert false, 'fail' if a > 98 and b == 99 # no or matching indent - otherwise OK assert true, 'OK - 0' else, assert false, 'fail' if a > 98 and b == 99 assert true, 'OK - 4 indents' else assert false, 'fail' if a > 98 and b == 99, assert true, 'OK - 2' else, assert false, 'fail' /# TODO Fix this case if a > 98 and b == 99, assert true, 'OK - 2' else, assert true, 'fail' #/ # pathological back indentation if a > 98 and b == 99 assert true, 'OK - 1 DEDENT)' else assert false, 'fail' # non multiline if b==99 or a==99 assert true, 'normal' if b==99 or a==99, assert true, 'normal'