1 AT_BANNER([test dir_name function])
3 m4_define([CHECK_DIR_NAME],
4 [AT_SETUP([dir_name("$1") returns "$2"])
5 AT_KEYWORDS([dir_name])
6 AT_CHECK([test-dir_name "AS_ESCAPE($1)"], [0], [$2
10 # These are the test cases given in POSIX for dirname().
11 CHECK_DIR_NAME([/usr/lib], [/usr])
12 CHECK_DIR_NAME([/usr/], [/])
13 CHECK_DIR_NAME([usr], [.])
14 CHECK_DIR_NAME([/], [/])
15 CHECK_DIR_NAME([.], [.])
16 CHECK_DIR_NAME([..], [.])
17 CHECK_DIR_NAME([//], [//]) # / is also allowed
18 CHECK_DIR_NAME([//foo], [//]) # / is also allowed
19 CHECK_DIR_NAME([], [.])
21 # Additional test cases.
22 CHECK_DIR_NAME([dir/file], [dir])
23 CHECK_DIR_NAME([dir/file/], [dir])
24 CHECK_DIR_NAME([dir/file//], [dir])
25 CHECK_DIR_NAME([///foo], [/])