test-fstab-util.c revision d15d0333be6a1ca7fdd99a1881d967b6be8f387a
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2015 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "fstab-util.h"
#include "util.h"
#include "log.h"
/*
int fstab_filter_options(const char *opts, const char *names,
const char **namefound, char **value, char **filtered);
*/
static void do_fstab_filter_options(const char *opts,
const char *remove,
int r_expected,
const char *name_expected,
const char *value_expected,
const char *filtered_expected) {
int r;
const char *name;
log_info("\"%s\" → %d, \"%s\", \"%s\", \"%s\", expected %d, \"%s\", \"%s\", \"%s\"",
assert_se(r == r_expected);
/* also test the malloc-less mode */
log_info("\"%s\" → %d, \"%s\", expected %d, \"%s\"",
assert_se(r == r_expected);
}
static void test_fstab_filter_options(void) {
/* check repeated options */
do_fstab_filter_options("first,opt=0,noopt=1,last=1", "opt\0noopt\0", 1, "noopt", "1", "first,last=1");
/* check that semicolons are not misinterpreted */
/* check that spaces are not misinterpreted */
/* check function will NULL args */
}
int main(void) {
}