OILS / doctools / help_gen_test.py View on Github | oilshell.org

53 lines, 16 significant
1#!/usr/bin/env python2
2"""
3help_gen_test.py: Tests for help_gen.py
4"""
5from __future__ import print_function
6
7import os
8import unittest
9from cStringIO import StringIO
10
11from doctools import help_gen # module under test
12
13
14class 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
34expr
35
36<h3>Literals</h2>
37
38oil literals
39
40<h4>oil-numbers</h4>
41
4242 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
52if __name__ == '__main__':
53 unittest.main()