Add test for blanks in URL path
[yaz-moved-to-github.git] / test / test_filepath.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2013 Index Data
3  * See the file LICENSE for details.
4  */
5
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9
10 #include <errno.h>
11 #include <string.h>
12 #include <stdlib.h>
13
14 #include <yaz/tpath.h>
15 #include <yaz/test.h>
16
17 void tst(void)
18 {
19     char fullpath[1024];
20     YAZ_CHECK(yaz_filepath_resolve("test_filepath", ".", 0, fullpath));
21     YAZ_CHECK(strcmp(fullpath, "./test_filepath") == 0);
22     YAZ_CHECK(!yaz_filepath_resolve("test_filepath1", ".", 0, fullpath));
23     YAZ_CHECK(!yaz_filepath_resolve("test_filepath", "bogus", 0, fullpath));
24     YAZ_CHECK(yaz_filepath_resolve("test_filepath", "bogus:.", 0, fullpath));
25 }
26
27 int main (int argc, char **argv)
28 {
29     YAZ_CHECK_INIT(argc, argv);
30     tst();
31     YAZ_CHECK_TERM;
32 }
33 /*
34  * Local variables:
35  * c-basic-offset: 4
36  * c-file-style: "Stroustrup"
37  * indent-tabs-mode: nil
38  * End:
39  * vim: shiftwidth=4 tabstop=8 expandtab
40  */
41