[gtk-doc] tests: use multiline strings for inputs to preserve newlines
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] tests: use multiline strings for inputs to preserve newlines
- Date: Tue, 20 Nov 2018 21:24:16 +0000 (UTC)
commit 84af3c216cd935f29469a9227609aa51f2c6558b
Author: Stefan Sauer <ensonic users sf net>
Date: Tue Nov 20 22:23:08 2018 +0100
tests: use multiline strings for inputs to preserve newlines
This gets us closer to the real inputs.
tests/mkdb.py | 13 +++++++++++--
tests/scan.py | 27 +++++++++++++--------------
2 files changed, 24 insertions(+), 16 deletions(-)
---
diff --git a/tests/mkdb.py b/tests/mkdb.py
index d44b667..bc4a88c 100644
--- a/tests/mkdb.py
+++ b/tests/mkdb.py
@@ -26,11 +26,20 @@ from gtkdoc import mkdb
class ScanSourceContent(unittest.TestCase):
def setUp(self):
- pass
+ mkdb.MODULE = 'test'
def test_EmptyInput(self):
mkdb.ScanSourceContent([])
- self.assertEquals({}, mkdb.SourceSymbolDocs)
+ self.assertEqual({}, mkdb.SourceSymbolDocs)
+
+ def test_FindsDocComment(self):
+ mkdb.ScanSourceContent("""\
+ /**
+ * symbol:
+ *
+ * Description.
+ */""".splitlines(keepends=True))
+ self.assertEqual({'symbol': 'Description.\n'}, mkdb.SourceSymbolDocs)
if __name__ == '__main__':
diff --git a/tests/scan.py b/tests/scan.py
index 98ce93f..2dab69d 100644
--- a/tests/scan.py
+++ b/tests/scan.py
@@ -54,28 +54,27 @@ class ScanHeaderContent(ScanHeaderContentTestCase):
self.assertNothingFound(slist, doc_comments)
def test_FindsDocComment(self):
- slist, doc_comments = self.scanHeaderContent([
- '/** FooBar:',
- ' */'
- ])
+ slist, doc_comments = self.scanHeaderContent("""\
+ /**
+ * Symbol:
+ */""".splitlines(keepends=True))
self.assertEqual(1, len(doc_comments))
- self.assertIn('foobar', doc_comments)
+ self.assertIn('symbol', doc_comments)
def test_DocDoesNotChangeSlistDeclAndTypes(self):
- slist, doc_comments = self.scanHeaderContent([
- '/** FooBar:',
- ' */'
- ])
+ slist, doc_comments = self.scanHeaderContent("""\
+ /**
+ * Symbol:
+ */""".splitlines(keepends=True))
self.assertNoDeclFound(slist)
# TODO: test /* < private_header > */ maker
def test_SkipSymbolWithPreprocessor(self):
- slist, doc_comments = self.scanHeaderContent([
- '#ifndef __GTK_DOC_IGNORE__',
- 'extern int bug_512565(void);'
- '#endif'
- ])
+ slist, doc_comments = self.scanHeaderContent("""\
+ #ifndef __GTK_DOC_IGNORE__
+ extern int bug_512565(void);
+ #endif""".splitlines(keepends=True))
self.assertNoDeclFound(slist)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]