]>
Commit | Line | Data |
---|---|---|
e1aff6f9 BP |
1 | AT_BANNER([test dir_name and base_name functions]) |
2 | ||
3 | m4_define([CHECK_FILE_NAME], | |
4 | [AT_SETUP([components of "$1" are "$2", "$3"]) | |
5 | AT_KEYWORDS([dir_name base_name]) | |
6 | AT_CHECK([test-file_name "AS_ESCAPE($1)"], [0], [$2 | |
7 | $3 | |
8 | ]) | |
9 | AT_CLEANUP]) | |
10 | ||
11 | # These are the test cases given in POSIX for dirname() and basename(). | |
12 | CHECK_FILE_NAME([/usr/lib], [/usr], [lib]) | |
13 | CHECK_FILE_NAME([/usr/], [/], [usr]) | |
14 | CHECK_FILE_NAME([usr], [.], [usr]) | |
15 | CHECK_FILE_NAME([/], [/], [/]) | |
16 | CHECK_FILE_NAME([.], [.], [.]) | |
17 | CHECK_FILE_NAME([..], [.], [..]) | |
18 | CHECK_FILE_NAME([//], [//], [//]) # / is also allowed | |
19 | CHECK_FILE_NAME([//foo], [//], [foo]) # / is also allowed for dirname | |
20 | CHECK_FILE_NAME([], [.], [.]) | |
21 | ||
22 | # Additional test cases. | |
23 | CHECK_FILE_NAME([dir/file], [dir], [file]) | |
24 | CHECK_FILE_NAME([dir/file/], [dir], [file]) | |
25 | CHECK_FILE_NAME([dir/file//], [dir], [file]) | |
26 | CHECK_FILE_NAME([///foo], [/], [foo]) |