test_std_code_java.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_parser(self):
  24. runner = tests.common.ToolRunner('collect', ['--std.code.complexity.on'])
  25. self.assertExec(runner.run())
  26. runner = tests.common.ToolRunner('export', ['--general.nest-regions'])
  27. self.assertExec(runner.run())
  28. dirs_list = [os.path.join('.', each) for each in os.listdir(self.get_content_paths().cwd)]
  29. runner = tests.common.ToolRunner('export',
  30. opts_list=['--general.nest-regions', '--general.format=txt'],
  31. dirs_list=dirs_list,
  32. prefix='files')
  33. self.assertExec(runner.run())
  34. runner = tests.common.ToolRunner('limit',
  35. ['--general.max-limit=std.code.complexity:cyclomatic:5'],
  36. exit_code=6)
  37. self.assertExec(runner.run())
  38. if __name__ == '__main__':
  39. unittest.main()