Esempio n. 1
0
 def testParseArrayLiteral(self):
     string = "[1, 2, 3]"
     parser = self.makeStringParser(string)
     result = parser.parse_array_literal()
     self.assertIsNode('ArrayLiteral', result)
     self.assertEquals(3, len(result.elements))
     for i in xrange(3):
         self.assertIsNode('NumberLiteral', result.elements[i])
Esempio n. 2
0
 def testParseArrayLiteralElision(self):
     string = "[1,,2]"
     parser = self.makeStringParser(string)
     result = parser.parse_array_literal()
     self.assertIsNode('ArrayLiteral', result)
     self.assertEquals(3, len(result.elements))
     self.assertIsNode('NumberLiteral', result.elements[0])
     self.assertIsNode('Elision', result.elements[1])
     self.assertIsNode('NumberLiteral', result.elements[2])