Browse Source

Added test for help.

avkonst 12 years ago
parent
commit
a83b7747a5

+ 14 - 0
mainline/tests/general/test_basic.py

@@ -133,6 +133,20 @@ class TestBasic(tests.common.TestCase):
                                          use_prev=True)
                                          use_prev=True)
         self.assertExec(runner.run())
         self.assertExec(runner.run())
 
 
+    def test_help(self):
+        
+        runner = tests.common.ToolRunner('collect', ['--help'])
+        self.assertExec(runner.run())
+
+        runner = tests.common.ToolRunner('export', ['--help'])
+        self.assertExec(runner.run())
+
+        runner = tests.common.ToolRunner('limit', ['--help'])
+        self.assertExec(runner.run())
+
+        runner = tests.common.ToolRunner('info', ['--help'])
+        self.assertExec(runner.run())
+		
 
 
 if __name__ == '__main__':
 if __name__ == '__main__':
     unittest.main()
     unittest.main()

+ 40 - 0
mainline/tests/general/test_basic/test_help_collect_default_stdout.gold.txt

@@ -0,0 +1,40 @@
+Usage: collect.py [options] -- [path 1] ... [path N]
+
+Options:
+  -h, --help            show this help message and exit
+  --general.db-file=GENERAL.DB_FILE
+                        Primary database file to write (by the collector) and
+                        post-process (by other tools) [default: ./metrixpp.db]
+  --general.db-file-prev=GENERAL.DB_FILE_PREV
+                        Database file with data collected for the
+                        past/previous revision. If it is set for the collector
+                        tool to perform an incremental/iterative collection,
+                        it may reduce the processing time significantly. Post-
+                        processing tools use it in order to recognise/evaluate
+                        change trends. [default: none].
+  --general.non-recursively
+                        If the option is set (True), sub-directories are not
+                        processed [default: False]
+  --general.exclude-files=GENERAL.EXCLUDE_FILES
+                        Defines the pattern to exclude files from processing
+                        [default: ^[.]]
+  --general.proctime.on
+                        If the option is set (True), the tool measures
+                        processing time per every file [default: False]
+  --general.log-level=GENERAL.LOG_LEVEL
+                        Defines log level. Possible values are
+                        'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
+                        inherited from environment variable
+                        'METRIXPLUSPLUS_LOG_LEVEL' if set. Otherwise, it is
+                        'ERROR' [default: ERROR]
+  --std.code.complexity.on
+                        Enables collection of complexity metrics: cyclomatic
+                        by McCabe [default: False]
+  --std.code.cpp.files=STD.CODE.CPP.FILES
+                        Enumerates filename extensions to match C/C++ files
+                        [default: *.c,*.cpp,*.h,*.hpp]
+  --std.code.dumper.on  If the option is set (True), HTML files are generated
+                        for every parsed file containing code (for
+                        troubleshooting purposes only) [default: False]
+  --std.code.test.on    Enables test plugin (for development purposes)
+                        [default: False]

+ 29 - 0
mainline/tests/general/test_basic/test_help_export_default_stdout.gold.txt

@@ -0,0 +1,29 @@
+Usage: export.py [options] -- [path 1] ... [path N]
+
+Options:
+  -h, --help            show this help message and exit
+  --general.log-level=GENERAL.LOG_LEVEL
+                        Defines log level. Possible values are
+                        'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
+                        inherited from environment variable
+                        'METRIXPLUSPLUS_LOG_LEVEL' if set. Otherwise, it is
+                        'ERROR' [default: ERROR]
+  --general.db-file=GENERAL.DB_FILE
+                        Primary database file to write (by the collector) and
+                        post-process (by other tools) [default: ./metrixpp.db]
+  --general.db-file-prev=GENERAL.DB_FILE_PREV
+                        Database file with data collected for the
+                        past/previous revision. If it is set for the collector
+                        tool to perform an incremental/iterative collection,
+                        it may reduce the processing time significantly. Post-
+                        processing tools use it in order to recognise/evaluate
+                        change trends. [default: none].
+  --general.format=GENERAL.FORMAT
+                        Format of the output data. Possible values are 'xml',
+                        'txt' or 'python' [default: xml]
+  --general.namespaces=GENERAL.NAMESPACES
+                        Allows to enumerate namespaces of interest. If not
+                        defined all namespaces available in database file will
+                        be processed. Separate several namespaces by comma,
+                        for example 'general,std.code.complexity' [default:
+                        none]

+ 20 - 0
mainline/tests/general/test_basic/test_help_info_default_stdout.gold.txt

@@ -0,0 +1,20 @@
+Usage: info.py [options]
+
+Options:
+  -h, --help            show this help message and exit
+  --general.log-level=GENERAL.LOG_LEVEL
+                        Defines log level. Possible values are
+                        'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
+                        inherited from environment variable
+                        'METRIXPLUSPLUS_LOG_LEVEL' if set. Otherwise, it is
+                        'ERROR' [default: ERROR]
+  --general.db-file=GENERAL.DB_FILE
+                        Primary database file to write (by the collector) and
+                        post-process (by other tools) [default: ./metrixpp.db]
+  --general.db-file-prev=GENERAL.DB_FILE_PREV
+                        Database file with data collected for the
+                        past/previous revision. If it is set for the collector
+                        tool to perform an incremental/iterative collection,
+                        it may reduce the processing time significantly. Post-
+                        processing tools use it in order to recognise/evaluate
+                        change trends. [default: none].

+ 42 - 0
mainline/tests/general/test_basic/test_help_limit_default_stdout.gold.txt

@@ -0,0 +1,42 @@
+Usage: limit.py [options] -- [path 1] ... [path N]
+
+Options:
+  -h, --help            show this help message and exit
+  --general.log-level=GENERAL.LOG_LEVEL
+                        Defines log level. Possible values are
+                        'DEBUG','INFO','WARNING' or 'ERROR'. Default value is
+                        inherited from environment variable
+                        'METRIXPLUSPLUS_LOG_LEVEL' if set. Otherwise, it is
+                        'ERROR' [default: ERROR]
+  --general.db-file=GENERAL.DB_FILE
+                        Primary database file to write (by the collector) and
+                        post-process (by other tools) [default: ./metrixpp.db]
+  --general.db-file-prev=GENERAL.DB_FILE_PREV
+                        Database file with data collected for the
+                        past/previous revision. If it is set for the collector
+                        tool to perform an incremental/iterative collection,
+                        it may reduce the processing time significantly. Post-
+                        processing tools use it in order to recognise/evaluate
+                        change trends. [default: none].
+  --general.warn=GENERAL.WARN
+                        Defines the warnings mode. 'new' - warnings for new
+                        regions only, 'trend' - warnings for new regions and
+                        for bad trend of modified regions, 'touched' -
+                        warnings for new regions and modified regions, 'all' -
+                        all warnings active [default: all]
+  --general.min-limit=GENERAL.MIN_LIMIT
+                        A threshold per 'namespace:field' metric in order to
+                        select regions, which have got metric value less than
+                        the specified limit. This option can be specified
+                        multiple times, if it is necessary to apply several
+                        limits. Should be in the format: <namespace>:<field
+                        >:<limit-value>, for example:
+                        'std.code.complexity:cyclomatic:7'.
+  --general.max-limit=GENERAL.MAX_LIMIT
+                        A threshold per 'namespace:field' metric in order to
+                        select regions, which have got metric value more than
+                        the specified limit. This option can be specified
+                        multiple times, if it is necessary to apply several
+                        limits. Should be in the format: <namespace>:<field
+                        >:<limit-value>, for example:
+                        'std.code.complexity:cyclomatic:7'.