Skip to content

Commit 8d20150

Browse files
wrapper.py: more extensive coverage
1 parent 714b200 commit 8d20150

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
@@ -73,3 +73,20 @@ ELSE(PYTHONINTERP_FOUND)
7373

7474
ENDIF(PYTHONINTERP_FOUND)
7575

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

0 commit comments

Comments
 (0)