From 676aa52b0541b733a1e733e9a53f44d2235ad1b8 Mon Sep 17 00:00:00 2001 From: Laurent MAZET Date: Mon, 5 Oct 2026 17:58:28 +0200 Subject: [PATCH] extend tests --- html2txt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/html2txt.c b/html2txt.c index 94b1b07..2b5183f 100644 --- a/html2txt.c +++ b/html2txt.c @@ -135,9 +135,10 @@ int main (int argc, char *argv[]) break; case '&': if (pt[1] == '#') { - pt += 1 + check_code (pt + 2, out); + pt += check_code (pt + 2, out); if (*out != '\0') { glyph = out; + pt++; } } else { pt += check_element (pt + 1, &glyph); @@ -148,6 +149,7 @@ int main (int argc, char *argv[]) } } else { strncpy (out, pt, 1); + out[1] = '\0'; } break; default: @@ -165,11 +167,16 @@ int main (int argc, char *argv[]) } /* test: html2txt.exe -h | grep usage */ +/* test: html2txt.exe x 2>&1 | grep 'invalid option' */ +/* test: html2txt.exe -x 2>&1; test $? -eq 1 */ /* test: html2txt.exe -i 2>&1 | grep missing */ /* test: html2txt.exe -v 2>&1 | grep missing */ /* test: html2txt.exe -i foobar 2>&1 | grep "can't open file" */ /* test: echo 'foob

a

r' | html2txt.exe | grep '^foobar$' */ /* test: echo 'ff;F;>=r' | html2txt.exe | grep '^foobar$' */ +/* test: echo 'f6F' | html2txt.exe -v 1| grep '^f6F$' */ +/* test: echo '&#foobar' | html2txt.exe -v 1| grep '^&#foobar$' */ +/* test: echo '&foobar' | html2txt.exe -v 2 | grep '^&foobar' */ /* test: html2txt.exe -i test.html >/dev/null */ /* vim: set ts=4 sw=4 et: */ -- 2.30.2