test_std_code_todo.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Metrix++, Copyright 2009-2019, Metrix++ Project
  3. # Link: https://github.com/metrixplusplus/metrixplusplus
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. import unittest
  8. import os
  9. import tests.common
  10. class Test(tests.common.TestCase):
  11. def test_comments(self):
  12. runner = tests.common.ToolRunner('collect', ['--std.code.todo.comments'])
  13. self.assertExec(runner.run())
  14. dirs_list = [os.path.join('.', each) for each in sorted(os.listdir(self.get_content_paths().cwd))]
  15. runner = tests.common.ToolRunner('view',
  16. opts_list=['--nest-regions', '--format=txt'],
  17. dirs_list=dirs_list,
  18. prefix='files')
  19. self.assertExec(runner.run())
  20. def test_strings(self):
  21. runner = tests.common.ToolRunner('collect', ['--std.code.todo.strings'])
  22. self.assertExec(runner.run())
  23. dirs_list = [os.path.join('.', each) for each in sorted(os.listdir(self.get_content_paths().cwd))]
  24. runner = tests.common.ToolRunner('view',
  25. opts_list=['--nest-regions', '--format=txt'],
  26. dirs_list=dirs_list,
  27. prefix='files')
  28. self.assertExec(runner.run())
  29. def test_tags(self):
  30. runner = tests.common.ToolRunner('collect', ['--sctc', '--scts',
  31. '--std.code.todo.tags=FIX-ME,FIXME'],
  32. exit_code=2,
  33. prefix='badtag',
  34. check_stderr=[(0, -1)])
  35. self.assertExec(runner.run())
  36. runner = tests.common.ToolRunner('collect', ['--sctc', '--scts',
  37. '--std.code.todo.tags=TOBEDONE,TODO,FIXME'])
  38. self.assertExec(runner.run())
  39. runner = tests.common.ToolRunner('view',)
  40. self.assertExec(runner.run())
  41. if __name__ == '__main__':
  42. unittest.main()