unit test pgm

This commit is contained in:
Olof hagsand 2018-05-19 00:27:53 +02:00
parent 958c1c0197
commit b230215eaf

View file

@ -1151,7 +1151,7 @@ xpath_vec_flag(cxobj *xcur,
* Example run: * Example run:
echo "a\n<a><b/></a>" | xpath echo "a\n<a><b/></a>" | xpath
*/ */
#if 0 /* Test program */ #if 1 /* Test program */
static int static int
@ -1164,14 +1164,14 @@ usage(char *argv0)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i; int i;
cxobj **xv; cxobj **xv;
cxobj *x; cxobj *x;
cxobj *xn; cxobj *xn;
size_t xlen = 0; size_t xlen = 0;
int c; int c;
int len; int len;
char *buf = NULL; char *buf = NULL;
if (argc != 1){ if (argc != 1){
usage(argv[0]); usage(argv[0]);
@ -1184,6 +1184,7 @@ main(int argc, char **argv)
return -1; return -1;
} }
memset(buf, 0, len); memset(buf, 0, len);
i = 0;
while (1){ /* read the whole file */ while (1){ /* read the whole file */
if ((c = fgetc(stdin)) == EOF) if ((c = fgetc(stdin)) == EOF)
return -1; return -1;
@ -1199,6 +1200,7 @@ main(int argc, char **argv)
} }
buf[i++] = (char)(c&0xff); buf[i++] = (char)(c&0xff);
} }
x = NULL;
if (xml_parse_file(0, "</clicon>", NULL, &x) < 0){ if (xml_parse_file(0, "</clicon>", NULL, &x) < 0){
fprintf(stderr, "parsing 2\n"); fprintf(stderr, "parsing 2\n");
return -1; return -1;