Add new doxygen test doxygen_code_blocks
This does somewhat more detailed testing of the code block parsing, and also exercises the language identification of python doctest features. For now, it is only tested by python (javadoc translation may not correctly handle some of the characters that are used here).
This commit is contained in:
parent
569ac5ec4f
commit
5230afb3e1
3 changed files with 110 additions and 0 deletions
53
Examples/test-suite/python/doxygen_code_blocks_runme.py
Normal file
53
Examples/test-suite/python/doxygen_code_blocks_runme.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import doxygen_code_blocks
|
||||
import inspect
|
||||
import string
|
||||
import sys
|
||||
import comment_verifier
|
||||
|
||||
comment_verifier.check(inspect.getdoc(doxygen_code_blocks.function),
|
||||
"""\
|
||||
Test for code blocks
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
simple code block
|
||||
|
||||
More advanced usage with C++ characters:
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
std::vector<int> first; // empty vector of ints
|
||||
std::vector<int> second (4,100); // four ints with value 100
|
||||
std::vector<int> third (second.begin(),second.end()); // iterating through second
|
||||
std::vector<int> fourth (third); // a copy of third
|
||||
// the iterator constructor can also be used to construct from arrays:
|
||||
int myints[] = {16,2,77,29};
|
||||
std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
|
||||
|
||||
std::cout << "The contents of fifth are:";
|
||||
for (std::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it)
|
||||
std::cout << ' ' << *it;
|
||||
std::cout << '\\n';
|
||||
|
||||
A code block for C:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
printf("hello world");
|
||||
|
||||
A code block for Java:
|
||||
|
||||
.. code-block:: java
|
||||
|
||||
public class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
// Prints "Hello, World" to the terminal window.
|
||||
System.out.println("Hello, World");
|
||||
}
|
||||
}
|
||||
|
||||
A code block for python:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
print('hello world')""")
|
||||
Loading…
Add table
Add a link
Reference in a new issue