diff options
author | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2017-03-14 12:39:19 +0100 |
---|---|---|
committer | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2017-03-14 12:39:19 +0100 |
commit | 4045b861779689363ea772a2a0a388fa5959a776 (patch) | |
tree | 15154c55943f4105b2aa1231a348189940e7ab69 /tests/test_comments.py | |
parent | 2e1fc4ff825c817335870c12a8f47fff7fa26a8c (diff) | |
download | qtivi-qface-4045b861779689363ea772a2a0a388fa5959a776.tar.gz |
Added new iteration of structured documentation implementation.
Diffstat (limited to 'tests/test_comments.py')
-rw-r--r-- | tests/test_comments.py | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/test_comments.py b/tests/test_comments.py index d5234a8..707f759 100644 --- a/tests/test_comments.py +++ b/tests/test_comments.py @@ -13,6 +13,14 @@ log = logging.getLogger(__name__) inputPath = Path('tests/in') +def qdoc_translate(name, value): + if not value.startswith('http'): + value = value.replace('.', '::') + return r'\{0}{{{1}}}'.format(name, value) + + +# doc.DocObject.translate = translate + def loadEcho(): path = inputPath / 'org.example.echo.qface' return FileSystem.parse_document(path) @@ -20,6 +28,7 @@ def loadEcho(): def test_comment(): system = loadEcho() + doc.translate = None module = system.lookup('org.example.echo') assert module.comment == '/** module */' assert module @@ -27,7 +36,20 @@ def test_comment(): assert interface o = doc.parse_doc(interface.comment) # import pdb; pdb.set_trace() - assert o['brief'] == 'the brief' - assert o['description'] == ['the description', 'continues'] - assert o['deprecated'] is True + assert o.brief == 'the brief' + assert o.description == ['the description', 'continues {@link http://qt.io}'] + assert o.deprecated is True + # import pdb; pdb.set_trace() + assert o.see == ['org.example.echo.Echo', 'org.example', 'http://qt.io'] + +def test_qdoc_translate(): + system = loadEcho() + module = system.lookup('org.example.echo') + assert module.comment == '/** module */' + assert module + interface = system.lookup('org.example.echo.Echo') + assert interface + doc.translate = qdoc_translate + o = doc.parse_doc(interface.comment) + assert o.description == ['the description', 'continues \\link{http://qt.io}'] |