'Test _parse_string helper'

@data({'template': '${""}', 'result': {'start_index': 2, 'end_index': 4, 'quote_length': 1}}, {'template': "${''}", 'result': {'start_index': 2, 'end_index': 4, 'quote_length': 1}}, {'template': "${'Hello'}", 'result': {'start_index': 2, 'end_index': 9, 'quote_length': 1}}, {'template': '${"""    triple    """}', 'result': {'start_index': 2, 'end_index': 16, 'quote_length': 3}}, {'template': '    ${"    \\"    \\\\"}    ', 'result': {'start_index': 3, 'end_index': 11, 'quote_length': 1}}, {'template': "${'broken    string}", 'result': {'start_index': 2, 'end_index': None, 'quote_length': None}})
def test_parse_string(self, data):

    linter = MakoTemplateLinter()
    parse_string = ParseString(data['template'], data['result']['start_index'], len(data['template']))
    string_dict = {'start_index': parse_string.start_index, 'end_index': parse_string.end_index, 'quote_length': parse_string.quote_length}
    self.assertDictEqual(string_dict, data['result'])
    if (parse_string.end_index is not None):
        self.assertEqual(data['template'][parse_string.start_index:parse_string.end_index], parse_string.string)
        start_inner_index = (parse_string.start_index + parse_string.quote_length)
        end_inner_index = (parse_string.end_index - parse_string.quote_length)
        self.assertEqual(data['template'][start_inner_index:end_inner_index], parse_string.string_inner)
