summaryrefslogtreecommitdiff
path: root/tests/scanner/test_sourcescanner.py
diff options
context:
space:
mode:
authorMark Doffman <mark.doffman@codethink.co.uk>2014-03-27 20:50:21 +0000
committerMark Doffman <mark.doffman@codethink.co.uk>2014-03-27 20:50:21 +0000
commit68ff94340891f1ae4ea24546acdbbc39c4dcbcd0 (patch)
tree46f02cba671bcb321482c7961acd91aeee57ced5 /tests/scanner/test_sourcescanner.py
parent19da3f81593614198206c45527f973a22cdd621e (diff)
parent89e84d06dffbc732bac26a105244b7270c42e3ec (diff)
downloadgobject-introspection-baserock/markdoffman/1_39_90-merge.tar.gz
Merge tag 'GOBJECT_INTROSPECTION_1_39_90' into baserock/markdoffman/1_39_90-mergebaserock/markdoffman/1_39_90-merge
Tag 1_39_90 Conflicts: autogen.sh configure.ac
Diffstat (limited to 'tests/scanner/test_sourcescanner.py')
-rw-r--r--tests/scanner/test_sourcescanner.py41
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()