summaryrefslogtreecommitdiff
path: root/src/test/test-fstab-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 23:40:46 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-01-11 23:41:42 -0500
commita75f4e2a02e287294b21ae9e5b1f28b2f8faea39 (patch)
tree76f9db5fdaf9774a0af34e3c226f4b581f375a46 /src/test/test-fstab-util.c
parent7f76961982e03d4d5f781e7e7113fc7eff970f82 (diff)
fstab-util: fix priority parsing and add test
Diffstat (limited to 'src/test/test-fstab-util.c')
-rw-r--r--src/test/test-fstab-util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test-fstab-util.c b/src/test/test-fstab-util.c
index 284484d656..50e5dee0a7 100644
--- a/src/test/test-fstab-util.c
+++ b/src/test/test-fstab-util.c
@@ -107,6 +107,22 @@ static void test_fstab_filter_options(void) {
do_fstab_filter_options("", "opt\0", 0, NULL, NULL, "");
}
+static void test_fstab_find_pri(void) {
+ int pri = -1;
+
+ assert_se(fstab_find_pri("pri", &pri) == 0);
+ assert_se(pri == -1);
+
+ assert_se(fstab_find_pri("pri=11", &pri) == 1);
+ assert_se(pri == 11);
+
+ assert_se(fstab_find_pri("opt,pri=12,opt", &pri) == 1);
+ assert_se(pri == 12);
+
+ assert_se(fstab_find_pri("opt,opt,pri=12,pri=13", &pri) == 1);
+ assert_se(pri == 13);
+}
+
static void test_fstab_yes_no_option(void) {
assert_se(fstab_test_yes_no_option("nofail,fail,nofail", "nofail\0fail\0") == true);
assert_se(fstab_test_yes_no_option("nofail,nofail,fail", "nofail\0fail\0") == false);
@@ -117,5 +133,6 @@ static void test_fstab_yes_no_option(void) {
int main(void) {
test_fstab_filter_options();
+ test_fstab_find_pri();
test_fstab_yes_no_option();
}