From 01aacfdf02a2a6d50ed8629cf91134d48786fa94 Mon Sep 17 00:00:00 2001 From: david parsons Date: Mon, 7 Oct 2024 01:25:16 -0700 Subject: [PATCH] add 3 testcases for mkd_basename (-b flag in the markdown program) --- basename.c | 2 +- tests/e_url.t | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/e_url.t diff --git a/basename.c b/basename.c index 30c4aac..2a1d225 100644 --- a/basename.c +++ b/basename.c @@ -20,7 +20,7 @@ e_basename(const char *string, const int size, void *context) char *ret; char *base = (char*)context; - if ( base && string && string[0] == '/' && (ret=malloc(strlen(base)+size+2)) ) { + if ( base && string && (string[0] == '/') && (ret=malloc(strlen(base)+size+2)) ) { strcpy(ret, base); strncat(ret, string, size); return ret; diff --git a/tests/e_url.t b/tests/e_url.t new file mode 100644 index 0000000..9cd7613 --- /dev/null +++ b/tests/e_url.t @@ -0,0 +1,13 @@ +. tests/functions.sh + +title "mkd_basename (e_url)" + +rc=0 +MARKDOWN_FLAGS= + +try -bHOHO 'empty []() with baseurl' '[]()' '

' +try -bHOHO '[]() with full url' '[](http://foo)' '

' +try -bHOHO '[]() with url fragment' '[](/foo)' '

' + +summary $0 +exit $rc