Skip to content

Commit 71b3037

Browse files
committed
Update ace_mode values used in tests
1 parent cdddfe1 commit 71b3037

1 file changed

Lines changed: 40 additions & 17 deletions

File tree

tests/test_todo_parser.py

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def count_issues_for_file_type(raw_issues, file_type):
1212
num_issues += 1
1313
return num_issues
1414

15+
1516
def get_issues_for_fields(raw_issues, fields):
1617
matching_issues = []
1718
for issue in raw_issues:
@@ -22,6 +23,7 @@ def get_issues_for_fields(raw_issues, fields):
2223
matching_issues.append(issue)
2324
return matching_issues
2425

26+
2527
def print_unexpected_issues(unexpected_issues):
2628
return '\n'.join([
2729
'',
@@ -60,12 +62,20 @@ def test_java_issues(self):
6062
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)
6163

6264
def test_javascript_issues(self):
63-
# Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX.
64-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5)
65+
# Includes 1 test for JSON with Comments.
66+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 1)
67+
68+
def test_json5_issues(self):
69+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'json5'), 1)
70+
71+
def test_tsx_issues(self):
72+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'tsx'), 3)
6573

6674
def test_ruby_issues(self):
67-
# Includes 2 tests for Crystal.
68-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 5)
75+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)
76+
77+
def test_crystal_issues(self):
78+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'crystal'), 2)
6979

7080
def test_abap_issues(self):
7181
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'abap'), 2)
@@ -89,7 +99,8 @@ def test_handlebars_issues(self):
8999
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'handlebars'), 2)
90100

91101
def test_text_issues(self):
92-
# Includes 2 tests for Org, 2 tests for GAP, 2 tests for Visual Basic, 2 tests for Agda, 4 tests for Sol, 4 tests for Move, 3 tests for AL
102+
# Includes 2 tests for Org, 2 tests for GAP, 2 tests for Visual Basic, 2 tests for Agda, 4 tests for Sol,
103+
# 4 tests for Move, 3 tests for AL
93104
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'text'), 19)
94105

95106
def test_scss_issues(self):
@@ -134,6 +145,7 @@ def test_dockerfile_issues(self):
134145
def test_powershell_issues(self):
135146
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'powershell'), 3)
136147

148+
137149
class CustomOptionsTest(unittest.TestCase):
138150
def setUp(self):
139151
parser = TodoParser(options={"identifiers":
@@ -153,7 +165,7 @@ def test_exact_identifier_match(self):
153165
154166
Other than case-insensitivity, an issue should only be matched if the
155167
identifier is exactly within the list of identifiers. For instances, if
156-
"FIX" is an identifier, it should NOT accidentaly match comments with
168+
"FIX" is an identifier, it should NOT accidentally match comments with
157169
the words "suffix" or "prefix".
158170
"""
159171
matching_issues = get_issues_for_fields(self.raw_issues,
@@ -242,8 +254,10 @@ def test_java_issues(self):
242254
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2)
243255

244256
def test_ruby_issues(self):
245-
# Includes 2 tests for Crystal.
246-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 5)
257+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)
258+
259+
def test_crystal_issues(self):
260+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'crystal'), 2)
247261

248262
def test_abap_issues(self):
249263
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'abap'), 2)
@@ -261,8 +275,14 @@ def test_starlark_issues(self):
261275
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5)
262276

263277
def test_javascript_issues(self):
264-
# Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX.
265-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5)
278+
# Includes 1 test for JSON with Comments.
279+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 1)
280+
281+
def test_json5_issues(self):
282+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'json5'), 1)
283+
284+
def test_tsx_issues(self):
285+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'tsx'), 3)
266286

267287
def test_autohotkey_issues(self):
268288
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1)
@@ -271,7 +291,8 @@ def test_handlebars_issues(self):
271291
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'handlebars'), 2)
272292

273293
def test_text_issues(self):
274-
# Includes 2 tests for Org, 2 tests for GAP, 2 tests for Visual Basic, 2 tests for Agda, 4 tests for Sol, 4 tests for Move, 3 tests for AL
294+
# Includes 2 tests for Org, 2 tests for GAP, 2 tests for Visual Basic, 2 tests for Agda, 4 tests for Sol,
295+
# 4 tests for Move, 3 tests for AL
275296
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'text'), 19)
276297

277298
def test_scss_issues(self):
@@ -316,6 +337,7 @@ def test_dockerfile_issues(self):
316337
def test_powershell_issues(self):
317338
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'powershell'), 3)
318339

340+
319341
class IgnorePatternTest(unittest.TestCase):
320342
def test_single_ignore(self):
321343
os.environ['INPUT_IGNORE'] = '.*\\.java'
@@ -328,8 +350,8 @@ def test_single_ignore(self):
328350
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
329351
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 4)
330352
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 0)
331-
# Includes 2 tests for Crystal.
332-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 5)
353+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)
354+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'crystal'), 2)
333355
os.environ['INPUT_IGNORE'] = ''
334356

335357
def test_multiple_ignores(self):
@@ -343,8 +365,8 @@ def test_multiple_ignores(self):
343365
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2)
344366
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'php'), 0)
345367
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 0)
346-
# Includes 2 tests for Crystal.
347-
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 5)
368+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'ruby'), 3)
369+
self.assertEqual(count_issues_for_file_type(self.raw_issues, 'crystal'), 2)
348370
os.environ['INPUT_IGNORE'] = ''
349371

350372

@@ -394,7 +416,7 @@ def test_custom_lang_load(self):
394416
self.assertIsNotNone(self.parser.languages_dict['ILS'])
395417
self.assertEqual(self.count_syntax(self.parser, 'ILS'), 1)
396418

397-
def test_custom_lang_not_dupplicate(self):
419+
def test_custom_lang_not_duplicate(self):
398420

399421
# Test if a custom language can overwrite the rules of an existing one
400422
self.assertEqual(self.count_syntax(self.parser, 'Java'), 1)
@@ -416,7 +438,8 @@ def tearDown(self):
416438

417439
class CustomLanguageUrlTest(BaseCustomLanguageTests.BaseTest):
418440
def setUp(self):
419-
os.environ['INPUT_LANGUAGES'] = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/master/tests/custom_languages.json'
441+
os.environ['INPUT_LANGUAGES'] = ('https://raw.githubusercontent.com/alstr/'
442+
'todo-to-issue-action/master/tests/custom_languages.json')
420443
os.environ['INPUT_NO_STANDARD'] = 'true'
421444
self.parser = TodoParser()
422445

0 commit comments

Comments
 (0)