Annotation of embedaddon/php/ext/standard/tests/file/dirname_basic-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test dirname() function : basic functionality
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --SKIPIF--
6: <?php
7: if(substr(PHP_OS, 0, 3) != "WIN")
8: die("skip Only valid for Windows");
9: ?>
10: --FILE--
11: <?php
12: /* Prototype : string dirname(string path)
13: * Description: Returns the directory name component of the path
14: * Source code: ext/standard/string.c
15: * Alias to functions:
16: */
17:
18: echo "*** Testing dirname() : basic functionality ***\n";
19:
20:
21: // Initialise all required variables
22: $paths = array(
23: '',
24: ' ',
25: 'c:',
26: 'c:\\',
27: 'c:/',
28: 'afile',
29: 'c:\test\afile',
30: 'c:\\test\\afile',
31: 'c://test//afile',
32: 'c:\test\afile\\',
33: '/usr/lib/locale/en_US',
34: '//usr/lib//locale/en_US',
35: '\\',
36: '\\\\',
37: '/',
38: '//',
39: '///',
40: '/usr/lib/locale/en_US/',
41: 'c:\windows/system32\drivers/etc\hosts',
42: '/usr\lib/locale\en_US',
43: ' c:\test\adir\afile.txt',
44: 'c:\test\adir\afile.txt ',
45: ' c:\test\adir\afile.txt ',
46: ' /usr/lib/locale/en_US',
47: '/usr/lib/locale/en_US ',
48: ' /usr/lib/locale/en_US ',
49: ' c:',
50: ' c:\test\adir\afile.txt',
51: '/usr',
52: '/usr/',
53: );
54:
55: foreach ($paths as $path) {
56: var_dump( dirname($path) );
57: }
58:
59: ?>
60: ===DONE===
61: --EXPECTF--
62: *** Testing dirname() : basic functionality ***
63: string(0) ""
64: string(1) "."
65: string(2) "c:"
66: string(3) "c:\"
67: string(3) "c:\"
68: string(1) "."
69: string(7) "c:\test"
70: string(7) "c:\test"
71: string(8) "c://test"
72: string(7) "c:\test"
73: string(15) "/usr/lib/locale"
74: string(17) "//usr/lib//locale"
75: string(1) "\"
76: string(1) "\"
77: string(1) "\"
78: string(1) "\"
79: string(1) "\"
80: string(15) "/usr/lib/locale"
81: string(31) "c:\windows/system32\drivers/etc"
82: string(15) "/usr\lib/locale"
83: string(15) " c:\test\adir"
84: string(12) "c:\test\adir"
85: string(15) " c:\test\adir"
86: string(18) " /usr/lib/locale"
87: string(15) "/usr/lib/locale"
88: string(18) " /usr/lib/locale"
89: string(1) "."
90: string(14) " c:\test\adir"
91: string(1) "\"
92: string(1) "\"
93: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>