Skip to content

Commit

Permalink
wrapper.py: more extensive coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuDuponchelle committed Jan 5, 2017
1 parent ce27a8f commit 56ddc83
Show file tree
Hide file tree
Showing 5 changed files with 1,476 additions and 31 deletions.
5 changes: 5 additions & 0 deletions src/cmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ static void *xrealloc(void *ptr, size_t size) {
return new_ptr;
}

void cmark_default_mem_free(void *ptr)
{
free(ptr);
}

cmark_mem DEFAULT_MEM_ALLOCATOR = {xcalloc, xrealloc, free};

char *cmark_markdown_to_html(const char *text, size_t len, int options) {
Expand Down
5 changes: 5 additions & 0 deletions src/cmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ typedef struct cmark_mem {
void (*free)(void *);
} cmark_mem;

/** Convenience function for bindings.
*/
CMARK_EXPORT
void cmark_default_mem_free(void *ptr);

/**
* ## Creating and Destroying Nodes
*/
Expand Down
17 changes: 17 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,20 @@ ELSE(PYTHONINTERP_FOUND)

ENDIF(PYTHONINTERP_FOUND)

if (PYTHON_BINDING_TESTS)
find_package(PythonInterp 3 REQUIRED)
else(PYTHON_BINDING_TESTS)
find_package(PythonInterp 3)
endif(PYTHON_BINDING_TESTS)

IF (PYTHONINTERP_FOUND)
add_test(python3_bindings
${PYTHON_EXECUTABLE}
"${CMAKE_CURRENT_SOURCE_DIR}/test_cmark.py"
"${CMAKE_CURRENT_BINARY_DIR}/../src"
)
ELSE(PYTHONINTERP_FOUND)
message("\n*** A python 3 interpreter is required to run the python binding tests.\n")
add_test(skipping_python_binding_tests
echo "Skipping python binding tests, because no python 3 interpreter is available.")
ENDIF(PYTHONINTERP_FOUND)
Loading

0 comments on commit 56ddc83

Please sign in to comment.