コード例 #1
0
 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}")
コード例 #2
0
 def test_print_table_with_named_fields(self):
     self.assertPrints(parse("x = {true = '1', false = '2'}"),
                       "x = {\n\ttrue = '1',\n\tfalse = '2'\n}")
コード例 #3
0
 def test_print_method(self):
     self.assertPrints(parse("o:m()"), "o:m()")
コード例 #4
0
 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)")
コード例 #5
0
 def test_print_functioncall_with_multiple_args(self):
     self.assertPrints(parse("f('argument',true,false)"),
                       "f('argument', true, false)")
コード例 #6
0
 def test_print_functioncall_chain(self):
     self.assertPrints(parse("f(a)(b, c, d)(e)"), "f(a)(b, c, d)(e)")
コード例 #7
0
 def test_print_functioncall_with_single_arg(self):
     self.assertPrints(parse("f 'argument'"), "f('argument')")
コード例 #8
0
 def test_print_functioncall_without_args(self):
     self.assertPrints(parse("f()"), "f()")
コード例 #9
0
 def test_print_assignments(self):
     self.assertPrints(parse("x = 'first'; y = 'second'"),
                       "x = 'first'\ny = 'second'")
コード例 #10
0
 def assertParsesBlock(self, code, expected):
     self.assertEqual(parse(code), expected)
コード例 #11
0
 def assertParsesFirstStatement(self, code, expected):
     self.assertEqual(parse(code)[0], expected)