Bug 1874684 - Part 6: Limit day length calculations to safe integers. r=mgaudet
[gecko.git] / tools / lint / test / test_codespell.py
blob8baae66b418e529c3b6f31f4882ebb0e752a2f20
1 import mozunit
3 LINTER = "codespell"
4 fixed = 0
7 def test_lint_codespell_fix(lint, create_temp_file):
8 contents = """This is a file with some typos and informations.
9 But also testing false positive like optin (because this isn't always option)
10 or stuff related to our coding style like:
11 aparent (aParent).
12 but detects mistakes like mozila
13 """.lstrip()
15 path = create_temp_file(contents, "ignore.rst")
16 lint([path], fix=True)
18 assert fixed == 2
21 def test_lint_codespell(lint, paths):
22 results = lint(paths())
23 assert len(results) == 2
25 assert results[0].message == "informations ==> information"
26 assert results[0].level == "error"
27 assert results[0].lineno == 1
28 assert results[0].relpath == "ignore.rst"
30 assert results[1].message == "mozila ==> mozilla"
31 assert results[1].level == "error"
32 assert results[1].lineno == 5
33 assert results[1].relpath == "ignore.rst"
36 if __name__ == "__main__":
37 mozunit.main()