X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-canonicalize.c;h=6794cf510e07acf63358cc369a4e94209a8144de;hb=38e8c084b95e98c4e763df8cfc43a141aa93fc5f;hp=f8d35365f456131cd5bd2bec7d30ca870f08383b;hpb=3220d5c6210870672d55ab27482fcdd1e964d75d;p=gnulib.git diff --git a/tests/test-canonicalize.c b/tests/test-canonicalize.c index f8d35365f..6794cf510 100644 --- a/tests/test-canonicalize.c +++ b/tests/test-canonicalize.c @@ -1,5 +1,5 @@ /* Test of execution of file name canonicalization. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,6 +82,9 @@ main (void) result2 = canonicalize_filename_mode (NULL, CAN_EXISTING); ASSERT (result2 == NULL); ASSERT (errno == EINVAL); + result2 = canonicalize_filename_mode (".", CAN_MISSING | CAN_ALL_BUT_LAST); + ASSERT (result2 == NULL); + ASSERT (errno == EINVAL); } /* Check that a non-directory with trailing slash yields NULL. */ @@ -134,6 +137,15 @@ main (void) ASSERT (symlink ("../s/2", BASE "/d/1") == 0); ASSERT (symlink ("//.//../..", BASE "/droot") == 0); + /* Check that symbolic links are not resolved, with CAN_NOLINKS. */ + { + char *result1 = canonicalize_filename_mode (BASE "/huk", CAN_NOLINKS); + ASSERT (result1 != NULL); + ASSERT (strcmp (result1 + strlen (result1) - strlen ("/" BASE "/huk"), + "/" BASE "/huk") == 0); + free (result1); + } + /* Check that the symbolic link to a file can be resolved. */ { char *result1 = canonicalize_file_name (BASE "/huk");