Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/librefuse lib
details: https://anonhg.NetBSD.org/src/rev/5ecb133c85c3
branches: trunk
changeset: 348902:5ecb133c85c3
user: pho <pho%NetBSD.org@localhost>
date: Tue Nov 15 00:32:42 2016 +0000
description:
lib
diffstat:
tests/lib/librefuse/t_refuse_opt.c | 44 ++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 2 deletions(-)
diffs (71 lines):
diff -r 7f59bbcfa4f8 -r 5ecb133c85c3 tests/lib/librefuse/t_refuse_opt.c
--- a/tests/lib/librefuse/t_refuse_opt.c Mon Nov 14 20:42:46 2016 +0000
+++ b/tests/lib/librefuse/t_refuse_opt.c Tue Nov 15 00:32:42 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_refuse_opt.c,v 1.2 2016/11/14 17:19:29 pho Exp $ */
+/* $NetBSD: t_refuse_opt.c,v 1.3 2016/11/15 00:32:42 pho Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_refuse_opt.c,v 1.2 2016/11/14 17:19:29 pho Exp $");
+__RCSID("$NetBSD: t_refuse_opt.c,v 1.3 2016/11/15 00:32:42 pho Exp $");
#include <atf-c.h>
@@ -106,12 +106,52 @@
ATF_CHECK_STREQ(opt, "fo\\\\o,ba\\,r");
}
+ATF_TC(efuse_opt_match);
+ATF_TC_HEAD(efuse_opt_match, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Check that fuse_opt_match(3) works"
+ " for every form of templates");
+}
+
+ATF_TC_BODY(efuse_opt_match, tc)
+{
+ struct fuse_opt o1[] = { FUSE_OPT_KEY("-x" , 0), FUSE_OPT_END };
+ struct fuse_opt o2[] = { FUSE_OPT_KEY("foo" , 0), FUSE_OPT_END };
+ struct fuse_opt o3[] = { FUSE_OPT_KEY("foo=" , 0), FUSE_OPT_END };
+ struct fuse_opt o4[] = { FUSE_OPT_KEY("foo=%s", 0), FUSE_OPT_END };
+ struct fuse_opt o5[] = { FUSE_OPT_KEY("-x " , 0), FUSE_OPT_END };
+ struct fuse_opt o6[] = { FUSE_OPT_KEY("-x %s" , 0), FUSE_OPT_END };
+
+ ATF_CHECK(fuse_opt_match(o1, "-x") == 1);
+ ATF_CHECK(fuse_opt_match(o1, "x") == 0);
+
+ ATF_CHECK(fuse_opt_match(o2, "foo") == 1);
+ ATF_CHECK(fuse_opt_match(o2, "-foo") == 0);
+
+ ATF_CHECK(fuse_opt_match(o3, "foo=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o3, "foo" ) == 0);
+
+ ATF_CHECK(fuse_opt_match(o4, "foo=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o4, "foo" ) == 0);
+
+ ATF_CHECK(fuse_opt_match(o5, "-xbar" ) == 1);
+ ATF_CHECK(fuse_opt_match(o5, "-x" ) == 1);
+ ATF_CHECK(fuse_opt_match(o5, "-x=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o5, "bar" ) == 0);
+
+ ATF_CHECK(fuse_opt_match(o6, "-xbar" ) == 1);
+ ATF_CHECK(fuse_opt_match(o6, "-x" ) == 1);
+ ATF_CHECK(fuse_opt_match(o6, "-x=bar") == 1);
+ ATF_CHECK(fuse_opt_match(o6, "bar" ) == 0);
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, efuse_opt_add_arg);
ATF_TP_ADD_TC(tp, efuse_opt_insert_arg);
ATF_TP_ADD_TC(tp, efuse_opt_add_opt);
ATF_TP_ADD_TC(tp, efuse_opt_add_opt_escaped);
+ ATF_TP_ADD_TC(tp, efuse_opt_match);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index