'Test _check_mako_file_is_safe provides detailed results, including line
numbers, columns, and line'

@data({'template': '\n${x    |    n}', 'parseable': True}, {'template': textwrap.dedent("\n                                                                                <div>${(\n                                                                                                'tabbed-multi-line-expression'\n                                                                                )    |    n}</div>\n                                                                "), 'parseable': True}, {'template': '${{unparseable}', 'parseable': False})
def test_expression_detailed_results(self, data):

    linter = MakoTemplateLinter()
    results = FileResults('')
    linter._check_mako_file_is_safe(data['template'], results)
    self.assertEqual(len(results.violations), 2)
    self.assertEqual(results.violations[0].rule, Rules.mako_missing_default)
    violation = results.violations[1]
    lines = list(data['template'].splitlines())
    self.assertTrue(('${' in lines[(violation.start_line - 1)]))
    self.assertTrue(lines[(violation.start_line - 1)].startswith('${', (violation.start_column - 1)))
    if data['parseable']:
        self.assertTrue(('}' in lines[(violation.end_line - 1)]))
        self.assertTrue(lines[(violation.end_line - 1)].startswith('}', ((violation.end_column - len('}')) - 1)))
    else:
        self.assertEqual(violation.start_line, violation.end_line)
        self.assertEqual(violation.end_column, '?')
    self.assertEqual(len(violation.lines), ((violation.end_line - violation.start_line) + 1))
    for line_index in range(0, len(violation.lines)):
        self.assertEqual(violation.lines[line_index], lines[((line_index + violation.start_line) - 1)])
