Skip to content

Commit a44cfaf

Browse files
wrapper.py: more extensive coverage
Add cmark_default_mem_free(pointer). API change.
1 parent 550e3eb commit a44cfaf

File tree

5 files changed

+1476
-31
lines changed

5 files changed

+1476
-31
lines changed

src/cmark.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ static void *xrealloc(void *ptr, size_t size) {
2424
return new_ptr;
2525
}
2626

27+
void cmark_default_mem_free(void *ptr)
28+
{
29+
free(ptr);
30+
}
31+
2732
cmark_mem DEFAULT_MEM_ALLOCATOR = {xcalloc, xrealloc, free};
2833

2934
char *cmark_markdown_to_html(const char *text, size_t len, int options) {

src/cmark.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ typedef struct cmark_mem {
123123
void (*free)(void *);
124124
} cmark_mem;
125125

126+
/** Convenience function for bindings.
127+
*/
128+
CMARK_EXPORT
129+
void cmark_default_mem_free(void *ptr);
130+
126131
/**
127132
* ## Creating and Destroying Nodes
128133
*/

test/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,20 @@ ELSE(PYTHONINTERP_FOUND)
7878

7979
ENDIF(PYTHONINTERP_FOUND)
8080

81+
if (PYTHON_BINDING_TESTS)
82+
find_package(PythonInterp 3 REQUIRED)
83+
else(PYTHON_BINDING_TESTS)
84+
find_package(PythonInterp 3)
85+
endif(PYTHON_BINDING_TESTS)
86+
87+
IF (PYTHONINTERP_FOUND)
88+
add_test(python3_bindings
89+
${PYTHON_EXECUTABLE}
90+
"${CMAKE_CURRENT_SOURCE_DIR}/test_cmark.py"
91+
"${CMAKE_CURRENT_BINARY_DIR}/../src"
92+
)
93+
ELSE(PYTHONINTERP_FOUND)
94+
message("\n*** A python 3 interpreter is required to run the python binding tests.\n")
95+
add_test(skipping_python_binding_tests
96+
echo "Skipping python binding tests, because no python 3 interpreter is available.")
97+
ENDIF(PYTHONINTERP_FOUND)

0 commit comments

Comments
 (0)