summary refs log blame commit diff stats
path: root/tests/manpage_completion_test.py
blob: b9504d06ff26421798690f6851e953abbf6c2cde (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13

                 

                                                                  








                                                                                  
                                  





























                                                                        
                                 





                                                                           

                                                                           


                          
                                
#!/usr/bin/python

from __future__ import (absolute_import, division, print_function)

import os.path
import re
import sys


# Add relevant ranger module to PATH... there surely is a better way to do this...
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))


def report(boolean, errormessage):
    if not boolean:
        sys.stderr.write('TEST FAILURE: ')
        sys.stderr.write(errormessage)
        sys.stderr.write('\n')
        sys.stderr.flush()


def get_path_of_man_page():
    dirpath_of_this_file = os.path.dirname(__file__)
    return os.path.join(dirpath_of_this_file, '..', 'doc', 'ranger.pod')


def read_manpage():
    path = get_path_of_man_page()
    return open(path, 'r').read()


def get_sections():
    manpage = read_manpage()
    parts = manpage.split('=head1 ')
    sections = dict()
    for part in parts:
        if '\n' in part:
            section_name, section_content = part.split('\n', 1)
            sections[section_name] = section_content
        else:
            pass
    return sections


def find_undocumented_settings():
    from ranger.container.settings import ALLOWED_SETTINGS
    sections = get_sections()
    setting_section = sections['SETTINGS']
    matcher_pattern = r'^=item [\w\d_, ]*{setting}'
    for setting in ALLOWED_SETTINGS:
        matcher = re.compile(matcher_pattern.format(setting=setting), re.M)
        report(matcher.search(setting_section),
               ('Setting %s is not documented in the man page!' % setting))


if __name__ == '__main__':
    find_undocumented_settings()
#&nbsp;copyright&nbsp;notice&nbsp;and&nbsp;this&nbsp;permission&nbsp;notice&nbsp;appear&nbsp;in&nbsp;all&nbsp;copies.<br> #<br> #&nbsp;THE&nbsp;SOFTWARE&nbsp;IS&nbsp;PROVIDED&nbsp;"AS&nbsp;IS"&nbsp;AND&nbsp;THE&nbsp;AUTHOR&nbsp;DISCLAIMS&nbsp;ALL&nbsp;WARRANTIES<br> #&nbsp;WITH&nbsp;REGARD&nbsp;TO&nbsp;THIS&nbsp;SOFTWARE&nbsp;INCLUDING&nbsp;ALL&nbsp;IMPLIED&nbsp;WARRANTIES&nbsp;OF<br> #&nbsp;MERCHANTABILITY&nbsp;AND&nbsp;FITNESS.&nbsp;IN&nbsp;NO&nbsp;EVENT&nbsp;SHALL&nbsp;THE&nbsp;AUTHOR&nbsp;BE&nbsp;LIABLE&nbsp;FOR<br> #&nbsp;ANY&nbsp;SPECIAL,&nbsp;DIRECT,&nbsp;INDIRECT,&nbsp;OR&nbsp;CONSEQUENTIAL&nbsp;DAMAGES&nbsp;OR&nbsp;ANY&nbsp;DAMAGES<br> #&nbsp;WHATSOEVER&nbsp;RESULTING&nbsp;FROM&nbsp;LOSS&nbsp;OF&nbsp;USE,&nbsp;DATA&nbsp;OR&nbsp;PROFITS,&nbsp;WHETHER&nbsp;IN&nbsp;AN<br> #&nbsp;ACTION&nbsp;OF&nbsp;CONTRACT,&nbsp;NEGLIGENCE&nbsp;OR&nbsp;OTHER&nbsp;TORTIOUS&nbsp;ACTION,&nbsp;ARISING&nbsp;OUT&nbsp;OF<br> #&nbsp;OR&nbsp;IN&nbsp;CONNECTION&nbsp;WITH&nbsp;THE&nbsp;USE&nbsp;OR&nbsp;PERFORMANCE&nbsp;OF&nbsp;THIS&nbsp;SOFTWARE.</tt></p> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ee77aa"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><dl> <dt><font face="helvetica, arial"><a href="builtins.html#Exception">builtins.Exception</a>(<a href="builtins.html#BaseException">builtins.BaseException</a>) </font></dt><dd> <dl> <dt><font face="helvetica, arial"><a href="ranger.container.history.html#HistoryEmptyException">HistoryEmptyException</a> </font></dt></dl> </dd> <dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a> </font></dt><dd> <dl> <dt><font face="helvetica, arial"><a href="ranger.container.history.html#History">History</a> </font></dt></dl> </dd> </dl> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="History">class <strong>History</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr> <tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%">Methods defined here:<br> <dl><dt><a name="History-__init__"><strong>__init__</strong></a>(self, maxlen<font color="#909090">=None</font>)</dt></dl> <dl><dt><a name="History-__iter__"><strong>__iter__</strong></a>(self)</dt></dl> <dl><dt><a name="History-__len__"><strong>__len__</strong></a>(self)</dt></dl> <dl><dt><a name="History-add"><strong>add</strong></a>(self, item)</dt></dl> <dl><dt><a name="History-back"><strong>back</strong></a>(self)</dt></dl> <dl><dt><a name="History-bottom"><strong>bottom</strong></a>(self)</dt></dl> <dl><dt><a name="History-current"><strong>current</strong></a>(self)</dt></dl> <dl><dt><a name="History-fast_forward"><strong>fast_forward</strong></a>(self)</dt></dl> <dl><dt><a name="History-forward"><strong>forward</strong></a>(self)</dt></dl> <dl><dt><a name="History-modify"><strong>modify</strong></a>(self, item)</dt></dl> <dl><dt><a name="History-move"><strong>move</strong></a>(self, n)</dt></dl> <dl><dt><a name="History-next"><strong>next</strong></a>(self)</dt></dl> <dl><dt><a name="History-top"><strong>top</strong></a>(self)</dt></dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__dict__</strong></dt> <dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd> </dl> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> </td></tr></table> <p> <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> <tr bgcolor="#ffc8d8"> <td colspan=3 valign=bottom>&nbsp;<br> <font color="#000000" face="helvetica, arial"><a name="HistoryEmptyException">class <strong>HistoryEmptyException</strong></a>(<a href="builtins.html#Exception">builtins.Exception</a>)</font></td></tr> <tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td> <td width="100%"><dl><dt>Method resolution order:</dt> <dd><a href="ranger.container.history.html#HistoryEmptyException">HistoryEmptyException</a></dd> <dd><a href="builtins.html#Exception">builtins.Exception</a></dd> <dd><a href="builtins.html#BaseException">builtins.BaseException</a></dd> <dd><a href="builtins.html#object">builtins.object</a></dd> </dl> <hr> Data descriptors defined here:<br> <dl><dt><strong>__weakref__</strong></dt> <dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd> </dl> <hr> Methods inherited from <a href="builtins.html#Exception">builtins.Exception</a>:<br> <dl><dt><a name="HistoryEmptyException-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#HistoryEmptyException-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;x.__class__.__doc__&nbsp;for&nbsp;signature</tt></dd></dl> <hr> Data and other attributes inherited from <a href="builtins.html#Exception">builtins.Exception</a>:<br> <dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object at 0x7f6a9223e120&gt;<dd><tt>T.<a href="#HistoryEmptyException-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="builtins.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl> <hr> Methods inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br> <dl><dt><a name="HistoryEmptyException-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#HistoryEmptyException-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl> <dl><dt><a name="HistoryEmptyException-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#HistoryEmptyException-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl> <dl><dt><a name="HistoryEmptyException-__reduce__"><strong>__reduce__</strong></a>(...)</dt></dl> <dl><dt><a name="HistoryEmptyException-__repr__"><strong>__repr__</strong></a>(...)</dt><dd><tt>x.<a href="#HistoryEmptyException-__repr__">__repr__</a>()&nbsp;&lt;==&gt;&nbsp;repr(x)</tt></dd></dl> <dl><dt><a name="HistoryEmptyException-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#HistoryEmptyException-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl> <dl><dt><a name="HistoryEmptyException-__setstate__"><strong>__setstate__</strong></a>(...)</dt></dl> <dl><dt><a name="HistoryEmptyException-__str__"><strong>__str__</strong></a>(...)</dt><dd><tt>x.<a href="#HistoryEmptyException-__str__">__str__</a>()&nbsp;&lt;==&gt;&nbsp;str(x)</tt></dd></dl> <dl><dt><a name="HistoryEmptyException-with_traceback"><strong>with_traceback</strong></a>(...)</dt><dd><tt><a href="builtins.html#Exception">Exception</a>.<a href="#HistoryEmptyException-with_traceback">with_traceback</a>(tb)&nbsp;--<br> set&nbsp;self.<strong>__traceback__</strong>&nbsp;to&nbsp;tb&nbsp;and&nbsp;return&nbsp;self.</tt></dd></dl> <hr> Data descriptors inherited from <a href="builtins.html#BaseException">builtins.BaseException</a>:<br> <dl><dt><strong>__cause__</strong></dt> <dd><tt>exception&nbsp;cause</tt></dd> </dl> <dl><dt><strong>__context__</strong></dt> <dd><tt>exception&nbsp;context</tt></dd> </dl> <dl><dt><strong>__dict__</strong></dt> </dl> <dl><dt><strong>__traceback__</strong></dt> </dl> <dl><dt><strong>args</strong></dt> </dl> </td></tr></table></td></tr></table> </body></html>