blob: 3963683d0021dea1625a8d644c6f40fc7cfa0861 (
plain)
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
|
import unittest
import tempfile
import os
from giscanner.sourcescanner import SourceScanner
two_typedefs_source = """
/**
* Spam:
*/
typedef struct _spam Spam;
/**
* Eggs:
*/
typedef struct _eggs Eggs;
"""
class Test(unittest.TestCase):
def setUp(self):
self.ss = SourceScanner()
tmp_fd, tmp_name = tempfile.mkstemp()
file = os.fdopen(tmp_fd, 'wt')
file.write(two_typedefs_source)
file.close()
self.ss.parse_files([tmp_name])
def test_get_symbols_length_consistency(self):
self.assertEqual(len(list(self.ss.get_symbols())), 2)
self.assertEqual(len(list(self.ss.get_symbols())), 2)
def test_get_comments_length_consistency(self):
self.assertEqual(len(list(self.ss.get_comments())), 2)
self.assertEqual(len(list(self.ss.get_comments())), 2)
if __name__ == '__main__':
unittest.main()
|