def test_print_table_with_unnamed_fields(self): self.assertPrints(parse("x = {true, false, 'test', nil}"), "x = {\n\ttrue,\n\tfalse,\n\t'test',\n\tnil\n}")
def test_print_table_with_named_fields(self): self.assertPrints(parse("x = {true = '1', false = '2'}"), "x = {\n\ttrue = '1',\n\tfalse = '2'\n}")
def test_print_method(self): self.assertPrints(parse("o:m()"), "o:m()")
def test_print_methodcall_chain(self): self.assertPrints(parse("o:m1(a):m2(b, c, d):m3(e)"), "o:m1(a):m2(b, c, d):m3(e)")
def test_print_functioncall_with_multiple_args(self): self.assertPrints(parse("f('argument',true,false)"), "f('argument', true, false)")
def test_print_functioncall_chain(self): self.assertPrints(parse("f(a)(b, c, d)(e)"), "f(a)(b, c, d)(e)")
def test_print_functioncall_with_single_arg(self): self.assertPrints(parse("f 'argument'"), "f('argument')")
def test_print_functioncall_without_args(self): self.assertPrints(parse("f()"), "f()")
def test_print_assignments(self): self.assertPrints(parse("x = 'first'; y = 'second'"), "x = 'first'\ny = 'second'")
def assertParsesBlock(self, code, expected): self.assertEqual(parse(code), expected)
def assertParsesFirstStatement(self, code, expected): self.assertEqual(parse(code)[0], expected)