refactor: clean up and split off diff file

test_new.diff had some issues which would cause
errors if trying to actually use the diff file
with 'patch' to create the files it references.

1) had some line numbers which were invalid
2) had path specifications and, unfortunately,
   'patch' does not support creating absent directories

The file has been cleaned up to have the create
line numbers and to assume that all files are at
the root.

Additionally, for the few cases where the diff
file referred to an edit rather than creation of a
whole new file, those diff hunks were moved into a
new, separate, file.

There is no functional change with this commit,
but it sets up future test features.
This commit is contained in:
Robert Alonso
2024-11-08 16:07:30 +00:00
parent d81fdc509c
commit da6872a340
3 changed files with 98 additions and 96 deletions

View File

@@ -17,10 +17,12 @@ class NewIssueTest(unittest.TestCase):
# Check for newly added TODOs across the files specified.
def setUp(self):
diff_file = open('tests/test_new.diff', 'r')
diff_file2 = open('tests/test_edit.diff', 'r')
parser = TodoParser()
with open('syntax.json', 'r') as syntax_json:
parser.syntax_dict = json.load(syntax_json)
self.raw_issues = parser.parse(diff_file)
self.raw_issues.extend(parser.parse(diff_file2))
def test_python_issues(self):
# Includes 4 tests for Starlark.