add 3 testcases for mkd_basename (-b flag in the markdown program)

This commit is contained in:
david parsons
2024-10-07 01:25:16 -07:00
parent c494e40d0a
commit 01aacfdf02
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -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;
+13
View File
@@ -0,0 +1,13 @@
. tests/functions.sh
title "mkd_basename (e_url)"
rc=0
MARKDOWN_FLAGS=
try -bHOHO 'empty []() with baseurl' '[]()' '<p><a href="HOHO"></a></p>'
try -bHOHO '[]() with full url' '[](http://foo)' '<p><a href="http://foo"></a></p>'
try -bHOHO '[]() with url fragment' '[](/foo)' '<p><a href="HOHO/foo"></a></p>'
summary $0
exit $rc