diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 7aa0e91d1..93128afd4 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -630,6 +630,7 @@ DOXYGEN_TEST_CASES += \ doxygen_translate \ doxygen_translate_all_tags \ doxygen_translate_links \ + doxygen_code_blocks \ $(DOXYGEN_TEST_CASES:=.cpptest): SWIGOPT += -doxygen diff --git a/Examples/test-suite/doxygen_code_blocks.i b/Examples/test-suite/doxygen_code_blocks.i new file mode 100644 index 000000000..220ae13a3 --- /dev/null +++ b/Examples/test-suite/doxygen_code_blocks.i @@ -0,0 +1,56 @@ +%module doxygen_code_blocks + +// This test is only used with Python + +%inline %{ + +/** + * \brief Test for code blocks + * + * \code + * simple code block + * \endcode + * + * More advanced usage with C++ characters: + * \code + * std::vector first; // empty vector of ints + * std::vector second (4,100); // four ints with value 100 + * std::vector third (second.begin(),second.end()); // iterating through second + * std::vector 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 fifth (myints, myints + sizeof(myints) / sizeof(int) ); + * + * std::cout << "The contents of fifth are:"; + * for (std::vector::iterator it = fifth.begin(); it != fifth.end(); ++it) + * std::cout << ' ' << *it; + * std::cout << '\n'; + * \endcode + * + * A code block for C: + * \code{.c} + * printf("hello world"); + * \endcode + * + * A code block for Java: + * \code{.java} + * public class HelloWorld { + * public static void main(String[] args) { + * // Prints "Hello, World" to the terminal window. + * System.out.println("Hello, World"); + * } + * } + * \endcode + * + * A code block for python: + * \code{.py} + * print('hello world') + * \endcode + */ +int function() +{ + return 0; +} + + +%} diff --git a/Examples/test-suite/python/doxygen_code_blocks_runme.py b/Examples/test-suite/python/doxygen_code_blocks_runme.py new file mode 100644 index 000000000..a421c8267 --- /dev/null +++ b/Examples/test-suite/python/doxygen_code_blocks_runme.py @@ -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 first; // empty vector of ints + std::vector second (4,100); // four ints with value 100 + std::vector third (second.begin(),second.end()); // iterating through second + std::vector 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 fifth (myints, myints + sizeof(myints) / sizeof(int) ); + + std::cout << "The contents of fifth are:"; + for (std::vector::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')""")