fuse_opt: testing

This commit is contained in:
Bill Zissimopoulos 2016-05-29 23:37:30 -07:00
parent ead273ae18
commit 10c3f6f507

View File

@ -9,7 +9,7 @@ struct data
int a, b, c, d, e, f, g, h; int a, b, c, d, e, f, g, h;
int i, j, k, l, m, n, o, p; int i, j, k, l, m, n, o, p;
char *q, *r, *s, *t; char *q, *r, *s, *t;
int u, v; int u, v, V;
char *w; char *w;
short x; short x;
long y; long y;
@ -141,6 +141,10 @@ static int fuse_opt_parse_test_proc(void *data0, const char *arg, int key,
ASSERT(0 == strcmp("-v86", arg)); ASSERT(0 == strcmp("-v86", arg));
data->v = 'V'; data->v = 'V';
return 1; return 1;
case 'V':
ASSERT(0 == strcmp("-V118", arg));
data->V = 'v';
return 1;
case 'w': case 'w':
ASSERT(0); ASSERT(0);
return -1; return -1;
@ -185,6 +189,7 @@ void fuse_opt_parse_test(void)
{ "-u ", offsetof(struct data, u), 'u' }, { "-u ", offsetof(struct data, u), 'u' },
FUSE_OPT_KEY("-v ", 'v'), FUSE_OPT_KEY("-v ", 'v'),
FUSE_OPT_KEY("-V ", 'V'),
{ "-w %s", offsetof(struct data, w), 'w' }, { "-w %s", offsetof(struct data, w), 'w' },
@ -223,6 +228,7 @@ void fuse_opt_parse_test(void)
"-otlong=TtTtTtTt", "-otlong=TtTtTtTt",
"-u85", "-u85",
"-v", "86", "-v", "86",
"-V118",
"-wWwWw", "-wWwWw",
"-x=65537", "-x=65537",
"-y=0x100000001", "-y=0x100000001",
@ -251,6 +257,7 @@ void fuse_opt_parse_test(void)
"-j=74", "-j=74",
"--llong=76", "--llong=76",
"-v86", "-v86",
"-V118",
"--keep", "--keep",
"--arg-keep", "--arg-keep",
"--", "--",
@ -292,6 +299,7 @@ void fuse_opt_parse_test(void)
ASSERT(0 == strcmp("TtTtTtTt", data.t)); ASSERT(0 == strcmp("TtTtTtTt", data.t));
ASSERT('u' == data.u); ASSERT('u' == data.u);
ASSERT('V' == data.v); ASSERT('V' == data.v);
ASSERT('v' == data.V);
ASSERT(0 == strcmp("WwWw", data.w)); ASSERT(0 == strcmp("WwWw", data.w));
ASSERT(1 == data.x); ASSERT(1 == data.x);
ASSERT((long)0x100000001 == data.y); ASSERT((long)0x100000001 == data.y);