-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjsdoc_test.py
54 lines (39 loc) · 1.11 KB
/
jsdoc_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import jsdoc
import unittest
class JsDocTestCase(unittest.TestCase):
def testProcessComment(self):
descriptions, flags = jsdoc.ProcessComment(_SCRIPT)
self.assertEquals([
('@flag', 'Thing thing'),
('@flag2', 'More thing.'),
('@flag3', 'More thing and\nmore thing.'),
('@flag4', 'One last thing.')],
flags)
self.assertEquals(
['This is a comment.', 'End of thing.'],
descriptions)
def testSplitSections(self):
parts = list(jsdoc._YieldSections(_SCRIPT))
self.assertEquals(
['@flag Thing thing',
'This is a comment.',
'@flag2 More thing.\n@flag3 More thing and\nmore thing.',
'End of thing.\n@flag4 One last thing.'],
parts)
def testMatchFlags(self):
matches = jsdoc._MatchFlags(_SCRIPT)
flags = [match.group('flag') for match in matches]
self.assertEquals(
['@flag', '@flag2', '@flag3', '@flag4'],
flags)
_SCRIPT = """\
@flag Thing thing
This is a comment.
@flag2 More thing.
@flag3 More thing and
more thing.
End of thing.
@flag4 One last thing.
"""
if __name__ == '__main__':
unittest.main()