diff options
Diffstat (limited to 'tests/scanner/test_sourcescanner.py')
-rw-r--r-- | tests/scanner/test_sourcescanner.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/scanner/test_sourcescanner.py b/tests/scanner/test_sourcescanner.py new file mode 100644 index 00000000..3963683d --- /dev/null +++ b/tests/scanner/test_sourcescanner.py @@ -0,0 +1,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() |