test_std_code_todo.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #
  2. # Metrix++, Copyright 2009-2013, Metrix++ Project
  3. # Link: http://metrixplusplus.sourceforge.net
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. # Metrix++ is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 3 of the License.
  10. #
  11. # Metrix++ is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Metrix++. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. import unittest
  20. import os
  21. import tests.common
  22. class Test(tests.common.TestCase):
  23. def test_comments(self):
  24. runner = tests.common.ToolRunner('collect', ['--std.code.todo.comments'])
  25. self.assertExec(runner.run())
  26. dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
  27. runner = tests.common.ToolRunner('view',
  28. opts_list=['--nest-regions', '--format=txt'],
  29. dirs_list=dirs_list,
  30. prefix='files')
  31. self.assertExec(runner.run())
  32. def test_strings(self):
  33. runner = tests.common.ToolRunner('collect', ['--std.code.todo.strings'])
  34. self.assertExec(runner.run())
  35. dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
  36. runner = tests.common.ToolRunner('view',
  37. opts_list=['--nest-regions', '--format=txt'],
  38. dirs_list=dirs_list,
  39. prefix='files')
  40. self.assertExec(runner.run())
  41. def test_tags(self):
  42. runner = tests.common.ToolRunner('collect', ['--sctc', '--scts',
  43. '--std.code.todo.tags=FIX-ME,FIXME'],
  44. exit_code=2,
  45. prefix='badtag',
  46. check_stderr=[(0, -1)])
  47. self.assertExec(runner.run())
  48. runner = tests.common.ToolRunner('collect', ['--sctc', '--scts',
  49. '--std.code.todo.tags=TOBEDONE,TODO,FIXME'])
  50. self.assertExec(runner.run())
  51. runner = tests.common.ToolRunner('view',)
  52. self.assertExec(runner.run())
  53. if __name__ == '__main__':
  54. unittest.main()