X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftest_tpath.c;fp=test%2Ftest_tpath.c;h=411ae8252a68082b009670bea538e0d8deb5aba1;hb=3107ce3a34993d2f784387f227a50343fff83bbc;hp=0000000000000000000000000000000000000000;hpb=ed31c923f03ec124060972f5351b8b33e07a2e13;p=yaz-moved-to-github.git diff --git a/test/test_tpath.c b/test/test_tpath.c new file mode 100644 index 0000000..411ae82 --- /dev/null +++ b/test/test_tpath.c @@ -0,0 +1,52 @@ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 Index Data + * See the file LICENSE for details. + */ +#include +#include +#include +#include + +#if HAVE_CONFIG_H +#include +#endif + + +static void tst_tpath(void) +{ + char fullpath[FILENAME_MAX]; + + YAZ_CHECK(!yaz_filepath_resolve("etc", 0, 0, fullpath)); + YAZ_CHECK(!yaz_filepath_resolve("etc", "", 0, fullpath)); /* bug #606 */ + YAZ_CHECK(!yaz_filepath_resolve("etc", ".", 0, fullpath)); + YAZ_CHECK(!yaz_filepath_resolve("does_not_exist", "", 0, fullpath)); + YAZ_CHECK(!yaz_filepath_resolve("does_not_exist", ".", 0, fullpath)); + YAZ_CHECK(yaz_filepath_resolve("test_tpath", 0, 0, fullpath)); + + YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "", 0, fullpath)); + YAZ_CHECK(yaz_filepath_resolve("test_tpath", ".", 0, fullpath)); + + YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir", 0, fullpath)); + YAZ_CHECK(yaz_filepath_resolve("test_tpath", "unknown_dir:.", 0, fullpath)); + YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir:", 0, fullpath)); + YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir:c:", 0, fullpath)); + YAZ_CHECK(!yaz_filepath_resolve("test_tpath", "unknown_dir:c:\\other", 0, fullpath)); + +} + +int main(int argc, char **argv) +{ + YAZ_CHECK_INIT(argc, argv); + tst_tpath(); + YAZ_CHECK_TERM; +} + +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +