| 1 | #!/usr/bin/env python2
|
| 2 | """
|
| 3 | help_gen_test.py: Tests for help_gen.py
|
| 4 | """
|
| 5 | from __future__ import print_function
|
| 6 |
|
| 7 | import os
|
| 8 | import unittest
|
| 9 | from cStringIO import StringIO
|
| 10 |
|
| 11 | from doctools import help_gen # module under test
|
| 12 |
|
| 13 |
|
| 14 | class MakeHelpTest(unittest.TestCase):
|
| 15 |
|
| 16 | def testTableOfContents(self):
|
| 17 | os.environ['OILS_VERSION'] = '0.7.pre5'
|
| 18 |
|
| 19 | # Three spaces before
|
| 20 | #
|
| 21 | # ! for deprecated -- conflicts with ! bang though
|
| 22 | # X for not implemented
|
| 23 |
|
| 24 | # Do we need markup here?
|
| 25 |
|
| 26 | line = ' [Overview] hello there X not-impl'
|
| 27 |
|
| 28 | print(help_gen.IndexLineToHtml('osh', line, []))
|
| 29 |
|
| 30 | def testSplitIntoCards(self):
|
| 31 | contents = """
|
| 32 | <h2>Oil Expression Language</h2>
|
| 33 |
|
| 34 | expr
|
| 35 |
|
| 36 | <h3>Literals</h2>
|
| 37 |
|
| 38 | oil literals
|
| 39 |
|
| 40 | <h4>oil-numbers</h4>
|
| 41 |
|
| 42 | 42 1e100
|
| 43 |
|
| 44 | <h4>oil-array</h4>
|
| 45 |
|
| 46 | %(a b)
|
| 47 | """
|
| 48 | cards = help_gen.SplitIntoCards(['h2', 'h3', 'h4'], contents)
|
| 49 | print(list(cards))
|
| 50 |
|
| 51 |
|
| 52 | if __name__ == '__main__':
|
| 53 | unittest.main()
|