def test_GypiFileListBuilder(self): gypi_file = GypiFile('', self.file_groups) existing_list = (" '/four/spaces/indent',\n'" " '/five/spaces/but/only/first/line/matters',\n") new_list = ['item1', 'item2', 'item3'] self.assertEqual( " 'item1',\n 'item2',\n 'item3',\n", gypi_file._GetReplacementListAsString(existing_list, new_list))
def test_GypiFileListBuilder(self): gypi_file = GypiFile("", self.file_groups) existing_list = """ '/four/spaces/indent', '/five/spaces/but/only/first/line/matters', """ new_list = ['item1', 'item2', 'item3'] try: assert (gypi_file._GetReplacementListAsString(existing_list, new_list) == """ 'item1',\n 'item2',\n 'item3',\n""") except: pass
def test_GypiTokenizer(self): content = ("useless data\n'group1': [\n <file list goes here>\n" " ]\nNote the four spaces before the ] above") gypi_files = GypiFile(content, self.file_groups) self.assertEqual(3, len(gypi_files._tokens)) self.assertEqual('plain', gypi_files._tokens[0].id) self.assertEqual("useless data\n'group1': [\n", gypi_files._tokens[0].data) self.assertEqual('group1', gypi_files._tokens[1].id) self.assertEqual(" <file list goes here>\n", gypi_files._tokens[1].data) self.assertEqual('plain', gypi_files._tokens[2].id) self.assertEqual(" ]\nNote the four spaces before the ] above", gypi_files._tokens[2].data)