def testSucess(self): lines = ['<color name="color1">#61000000</color>', '<color name="color1">#FFFFFF</color>'] mock_input_api = MockInputApi() mock_input_api.files = [MockFile('chrome/java/res_test/colors.xml', lines)] errors = checkxmlstyle._CheckDuplicateColors( mock_input_api, MockOutputApi()) self.assertEqual(0, len(errors))
def testFailure(self): lines = ['<color name="color1">#61000000</color>', '<color name="color2">#61000000</color>'] mock_input_api = MockInputApi() mock_input_api.files = [ MockFile(helpers.COLOR_PALETTE_RELATIVE_PATH, lines)] errors = checkxmlstyle._CheckDuplicateColors( mock_input_api, MockOutputApi()) self.assertEqual(1, len(errors)) self.assertEqual(2, len(errors[0].items)) self.assertEqual(' %s:1' % helpers.COLOR_PALETTE_RELATIVE_PATH, errors[0].items[0].splitlines()[0]) self.assertEqual(' %s:2' % helpers.COLOR_PALETTE_RELATIVE_PATH, errors[0].items[1].splitlines()[0])
def testFailure(self): lines = [ '<color name="color1">#61000000</color>', '<color name="color2">#61000000</color>' ] mock_input_api = MockInputApi() mock_input_api.files = [ MockFile('chrome/java/res_test/colors.xml', lines) ] errors = checkxmlstyle._CheckDuplicateColors(mock_input_api, MockOutputApi()) self.assertEqual(1, len(errors)) self.assertEqual(2, len(errors[0].items)) self.assertEqual(' chrome/java/res_test/colors.xml:1', errors[0].items[0].splitlines()[0]) self.assertEqual(' chrome/java/res_test/colors.xml:2', errors[0].items[1].splitlines()[0])