Annotation of embedaddon/php/ext/standard/tests/file/pathinfo_basic1-win32.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test pathinfo() 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: mixed pathinfo ( string $path [, int $options] );
! 13: Description: Returns information about a file path
! 14: */
! 15:
! 16: echo "*** Testing basic functions of pathinfo() ***\n";
! 17:
! 18: $paths = array (
! 19: '',
! 20: ' ',
! 21: 'c:',
! 22: 'c:\\',
! 23: 'c:/',
! 24: 'afile',
! 25: 'c:\test\adir',
! 26: 'c:\test\adir\\',
! 27: '/usr/include/arpa',
! 28: '/usr/include/arpa/',
! 29: 'usr/include/arpa',
! 30: 'usr/include/arpa/',
! 31: 'c:\test\afile',
! 32: 'c:\\test\\afile',
! 33: 'c://test//afile',
! 34: 'c:\test\afile\\',
! 35: 'c:\test\prog.exe',
! 36: 'c:\\test\\prog.exe',
! 37: 'c:/test/prog.exe',
! 38: '/usr/include/arpa/inet.h',
! 39: '//usr/include//arpa/inet.h',
! 40: '\\',
! 41: '\\\\',
! 42: '/',
! 43: '//',
! 44: '///',
! 45: '/usr/include/arpa/inet.h',
! 46: 'c:\windows/system32\drivers/etc\hosts',
! 47: '/usr\include/arpa\inet.h',
! 48: ' c:\test\adir\afile.txt',
! 49: 'c:\test\adir\afile.txt ',
! 50: ' c:\test\adir\afile.txt ',
! 51: ' /usr/include/arpa/inet.h',
! 52: '/usr/include/arpa/inet.h ',
! 53: ' /usr/include/arpa/inet.h ',
! 54: ' c:',
! 55: ' c:\test\adir\afile.txt',
! 56: '/usr',
! 57: '/usr/'
! 58: );
! 59:
! 60: $counter = 1;
! 61: /* loop through $paths to test each $path in the above array */
! 62: foreach($paths as $path) {
! 63: echo "-- Iteration $counter --\n";
! 64: var_dump( pathinfo($path, PATHINFO_DIRNAME) );
! 65: var_dump( pathinfo($path, PATHINFO_BASENAME) );
! 66: var_dump( pathinfo($path, PATHINFO_EXTENSION) );
! 67: var_dump( pathinfo($path, PATHINFO_FILENAME) );
! 68: var_dump( pathinfo($path) );
! 69: $counter++;
! 70: }
! 71:
! 72: echo "Done\n";
! 73: ?>
! 74: --EXPECTF--
! 75: *** Testing basic functions of pathinfo() ***
! 76: -- Iteration 1 --
! 77: string(0) ""
! 78: string(0) ""
! 79: string(0) ""
! 80: string(0) ""
! 81: array(2) {
! 82: ["basename"]=>
! 83: string(0) ""
! 84: ["filename"]=>
! 85: string(0) ""
! 86: }
! 87: -- Iteration 2 --
! 88: string(1) "."
! 89: string(1) " "
! 90: string(0) ""
! 91: string(1) " "
! 92: array(3) {
! 93: ["dirname"]=>
! 94: string(1) "."
! 95: ["basename"]=>
! 96: string(1) " "
! 97: ["filename"]=>
! 98: string(1) " "
! 99: }
! 100: -- Iteration 3 --
! 101: string(2) "c:"
! 102: string(2) "c:"
! 103: string(0) ""
! 104: string(2) "c:"
! 105: array(3) {
! 106: ["dirname"]=>
! 107: string(2) "c:"
! 108: ["basename"]=>
! 109: string(2) "c:"
! 110: ["filename"]=>
! 111: string(2) "c:"
! 112: }
! 113: -- Iteration 4 --
! 114: string(3) "c:\"
! 115: string(2) "c:"
! 116: string(0) ""
! 117: string(2) "c:"
! 118: array(3) {
! 119: ["dirname"]=>
! 120: string(3) "c:\"
! 121: ["basename"]=>
! 122: string(2) "c:"
! 123: ["filename"]=>
! 124: string(2) "c:"
! 125: }
! 126: -- Iteration 5 --
! 127: string(3) "c:\"
! 128: string(2) "c:"
! 129: string(0) ""
! 130: string(2) "c:"
! 131: array(3) {
! 132: ["dirname"]=>
! 133: string(3) "c:\"
! 134: ["basename"]=>
! 135: string(2) "c:"
! 136: ["filename"]=>
! 137: string(2) "c:"
! 138: }
! 139: -- Iteration 6 --
! 140: string(1) "."
! 141: string(5) "afile"
! 142: string(0) ""
! 143: string(5) "afile"
! 144: array(3) {
! 145: ["dirname"]=>
! 146: string(1) "."
! 147: ["basename"]=>
! 148: string(5) "afile"
! 149: ["filename"]=>
! 150: string(5) "afile"
! 151: }
! 152: -- Iteration 7 --
! 153: string(7) "c:\test"
! 154: string(4) "adir"
! 155: string(0) ""
! 156: string(4) "adir"
! 157: array(3) {
! 158: ["dirname"]=>
! 159: string(7) "c:\test"
! 160: ["basename"]=>
! 161: string(4) "adir"
! 162: ["filename"]=>
! 163: string(4) "adir"
! 164: }
! 165: -- Iteration 8 --
! 166: string(7) "c:\test"
! 167: string(4) "adir"
! 168: string(0) ""
! 169: string(4) "adir"
! 170: array(3) {
! 171: ["dirname"]=>
! 172: string(7) "c:\test"
! 173: ["basename"]=>
! 174: string(4) "adir"
! 175: ["filename"]=>
! 176: string(4) "adir"
! 177: }
! 178: -- Iteration 9 --
! 179: string(12) "/usr/include"
! 180: string(4) "arpa"
! 181: string(0) ""
! 182: string(4) "arpa"
! 183: array(3) {
! 184: ["dirname"]=>
! 185: string(12) "/usr/include"
! 186: ["basename"]=>
! 187: string(4) "arpa"
! 188: ["filename"]=>
! 189: string(4) "arpa"
! 190: }
! 191: -- Iteration 10 --
! 192: string(12) "/usr/include"
! 193: string(4) "arpa"
! 194: string(0) ""
! 195: string(4) "arpa"
! 196: array(3) {
! 197: ["dirname"]=>
! 198: string(12) "/usr/include"
! 199: ["basename"]=>
! 200: string(4) "arpa"
! 201: ["filename"]=>
! 202: string(4) "arpa"
! 203: }
! 204: -- Iteration 11 --
! 205: string(11) "usr/include"
! 206: string(4) "arpa"
! 207: string(0) ""
! 208: string(4) "arpa"
! 209: array(3) {
! 210: ["dirname"]=>
! 211: string(11) "usr/include"
! 212: ["basename"]=>
! 213: string(4) "arpa"
! 214: ["filename"]=>
! 215: string(4) "arpa"
! 216: }
! 217: -- Iteration 12 --
! 218: string(11) "usr/include"
! 219: string(4) "arpa"
! 220: string(0) ""
! 221: string(4) "arpa"
! 222: array(3) {
! 223: ["dirname"]=>
! 224: string(11) "usr/include"
! 225: ["basename"]=>
! 226: string(4) "arpa"
! 227: ["filename"]=>
! 228: string(4) "arpa"
! 229: }
! 230: -- Iteration 13 --
! 231: string(7) "c:\test"
! 232: string(5) "afile"
! 233: string(0) ""
! 234: string(5) "afile"
! 235: array(3) {
! 236: ["dirname"]=>
! 237: string(7) "c:\test"
! 238: ["basename"]=>
! 239: string(5) "afile"
! 240: ["filename"]=>
! 241: string(5) "afile"
! 242: }
! 243: -- Iteration 14 --
! 244: string(7) "c:\test"
! 245: string(5) "afile"
! 246: string(0) ""
! 247: string(5) "afile"
! 248: array(3) {
! 249: ["dirname"]=>
! 250: string(7) "c:\test"
! 251: ["basename"]=>
! 252: string(5) "afile"
! 253: ["filename"]=>
! 254: string(5) "afile"
! 255: }
! 256: -- Iteration 15 --
! 257: string(8) "c://test"
! 258: string(5) "afile"
! 259: string(0) ""
! 260: string(5) "afile"
! 261: array(3) {
! 262: ["dirname"]=>
! 263: string(8) "c://test"
! 264: ["basename"]=>
! 265: string(5) "afile"
! 266: ["filename"]=>
! 267: string(5) "afile"
! 268: }
! 269: -- Iteration 16 --
! 270: string(7) "c:\test"
! 271: string(5) "afile"
! 272: string(0) ""
! 273: string(5) "afile"
! 274: array(3) {
! 275: ["dirname"]=>
! 276: string(7) "c:\test"
! 277: ["basename"]=>
! 278: string(5) "afile"
! 279: ["filename"]=>
! 280: string(5) "afile"
! 281: }
! 282: -- Iteration 17 --
! 283: string(7) "c:\test"
! 284: string(8) "prog.exe"
! 285: string(3) "exe"
! 286: string(4) "prog"
! 287: array(4) {
! 288: ["dirname"]=>
! 289: string(7) "c:\test"
! 290: ["basename"]=>
! 291: string(8) "prog.exe"
! 292: ["extension"]=>
! 293: string(3) "exe"
! 294: ["filename"]=>
! 295: string(4) "prog"
! 296: }
! 297: -- Iteration 18 --
! 298: string(7) "c:\test"
! 299: string(8) "prog.exe"
! 300: string(3) "exe"
! 301: string(4) "prog"
! 302: array(4) {
! 303: ["dirname"]=>
! 304: string(7) "c:\test"
! 305: ["basename"]=>
! 306: string(8) "prog.exe"
! 307: ["extension"]=>
! 308: string(3) "exe"
! 309: ["filename"]=>
! 310: string(4) "prog"
! 311: }
! 312: -- Iteration 19 --
! 313: string(7) "c:/test"
! 314: string(8) "prog.exe"
! 315: string(3) "exe"
! 316: string(4) "prog"
! 317: array(4) {
! 318: ["dirname"]=>
! 319: string(7) "c:/test"
! 320: ["basename"]=>
! 321: string(8) "prog.exe"
! 322: ["extension"]=>
! 323: string(3) "exe"
! 324: ["filename"]=>
! 325: string(4) "prog"
! 326: }
! 327: -- Iteration 20 --
! 328: string(17) "/usr/include/arpa"
! 329: string(6) "inet.h"
! 330: string(1) "h"
! 331: string(4) "inet"
! 332: array(4) {
! 333: ["dirname"]=>
! 334: string(17) "/usr/include/arpa"
! 335: ["basename"]=>
! 336: string(6) "inet.h"
! 337: ["extension"]=>
! 338: string(1) "h"
! 339: ["filename"]=>
! 340: string(4) "inet"
! 341: }
! 342: -- Iteration 21 --
! 343: string(19) "//usr/include//arpa"
! 344: string(6) "inet.h"
! 345: string(1) "h"
! 346: string(4) "inet"
! 347: array(4) {
! 348: ["dirname"]=>
! 349: string(19) "//usr/include//arpa"
! 350: ["basename"]=>
! 351: string(6) "inet.h"
! 352: ["extension"]=>
! 353: string(1) "h"
! 354: ["filename"]=>
! 355: string(4) "inet"
! 356: }
! 357: -- Iteration 22 --
! 358: string(1) "\"
! 359: string(0) ""
! 360: string(0) ""
! 361: string(0) ""
! 362: array(3) {
! 363: ["dirname"]=>
! 364: string(1) "\"
! 365: ["basename"]=>
! 366: string(0) ""
! 367: ["filename"]=>
! 368: string(0) ""
! 369: }
! 370: -- Iteration 23 --
! 371: string(1) "\"
! 372: string(0) ""
! 373: string(0) ""
! 374: string(0) ""
! 375: array(3) {
! 376: ["dirname"]=>
! 377: string(1) "\"
! 378: ["basename"]=>
! 379: string(0) ""
! 380: ["filename"]=>
! 381: string(0) ""
! 382: }
! 383: -- Iteration 24 --
! 384: string(1) "\"
! 385: string(0) ""
! 386: string(0) ""
! 387: string(0) ""
! 388: array(3) {
! 389: ["dirname"]=>
! 390: string(1) "\"
! 391: ["basename"]=>
! 392: string(0) ""
! 393: ["filename"]=>
! 394: string(0) ""
! 395: }
! 396: -- Iteration 25 --
! 397: string(1) "\"
! 398: string(0) ""
! 399: string(0) ""
! 400: string(0) ""
! 401: array(3) {
! 402: ["dirname"]=>
! 403: string(1) "\"
! 404: ["basename"]=>
! 405: string(0) ""
! 406: ["filename"]=>
! 407: string(0) ""
! 408: }
! 409: -- Iteration 26 --
! 410: string(1) "\"
! 411: string(0) ""
! 412: string(0) ""
! 413: string(0) ""
! 414: array(3) {
! 415: ["dirname"]=>
! 416: string(1) "\"
! 417: ["basename"]=>
! 418: string(0) ""
! 419: ["filename"]=>
! 420: string(0) ""
! 421: }
! 422: -- Iteration 27 --
! 423: string(17) "/usr/include/arpa"
! 424: string(6) "inet.h"
! 425: string(1) "h"
! 426: string(4) "inet"
! 427: array(4) {
! 428: ["dirname"]=>
! 429: string(17) "/usr/include/arpa"
! 430: ["basename"]=>
! 431: string(6) "inet.h"
! 432: ["extension"]=>
! 433: string(1) "h"
! 434: ["filename"]=>
! 435: string(4) "inet"
! 436: }
! 437: -- Iteration 28 --
! 438: string(31) "c:\windows/system32\drivers/etc"
! 439: string(5) "hosts"
! 440: string(0) ""
! 441: string(5) "hosts"
! 442: array(3) {
! 443: ["dirname"]=>
! 444: string(31) "c:\windows/system32\drivers/etc"
! 445: ["basename"]=>
! 446: string(5) "hosts"
! 447: ["filename"]=>
! 448: string(5) "hosts"
! 449: }
! 450: -- Iteration 29 --
! 451: string(17) "/usr\include/arpa"
! 452: string(6) "inet.h"
! 453: string(1) "h"
! 454: string(4) "inet"
! 455: array(4) {
! 456: ["dirname"]=>
! 457: string(17) "/usr\include/arpa"
! 458: ["basename"]=>
! 459: string(6) "inet.h"
! 460: ["extension"]=>
! 461: string(1) "h"
! 462: ["filename"]=>
! 463: string(4) "inet"
! 464: }
! 465: -- Iteration 30 --
! 466: string(15) " c:\test\adir"
! 467: string(9) "afile.txt"
! 468: string(3) "txt"
! 469: string(5) "afile"
! 470: array(4) {
! 471: ["dirname"]=>
! 472: string(15) " c:\test\adir"
! 473: ["basename"]=>
! 474: string(9) "afile.txt"
! 475: ["extension"]=>
! 476: string(3) "txt"
! 477: ["filename"]=>
! 478: string(5) "afile"
! 479: }
! 480: -- Iteration 31 --
! 481: string(12) "c:\test\adir"
! 482: string(12) "afile.txt "
! 483: string(6) "txt "
! 484: string(5) "afile"
! 485: array(4) {
! 486: ["dirname"]=>
! 487: string(12) "c:\test\adir"
! 488: ["basename"]=>
! 489: string(12) "afile.txt "
! 490: ["extension"]=>
! 491: string(6) "txt "
! 492: ["filename"]=>
! 493: string(5) "afile"
! 494: }
! 495: -- Iteration 32 --
! 496: string(15) " c:\test\adir"
! 497: string(12) "afile.txt "
! 498: string(6) "txt "
! 499: string(5) "afile"
! 500: array(4) {
! 501: ["dirname"]=>
! 502: string(15) " c:\test\adir"
! 503: ["basename"]=>
! 504: string(12) "afile.txt "
! 505: ["extension"]=>
! 506: string(6) "txt "
! 507: ["filename"]=>
! 508: string(5) "afile"
! 509: }
! 510: -- Iteration 33 --
! 511: string(20) " /usr/include/arpa"
! 512: string(6) "inet.h"
! 513: string(1) "h"
! 514: string(4) "inet"
! 515: array(4) {
! 516: ["dirname"]=>
! 517: string(20) " /usr/include/arpa"
! 518: ["basename"]=>
! 519: string(6) "inet.h"
! 520: ["extension"]=>
! 521: string(1) "h"
! 522: ["filename"]=>
! 523: string(4) "inet"
! 524: }
! 525: -- Iteration 34 --
! 526: string(17) "/usr/include/arpa"
! 527: string(9) "inet.h "
! 528: string(4) "h "
! 529: string(4) "inet"
! 530: array(4) {
! 531: ["dirname"]=>
! 532: string(17) "/usr/include/arpa"
! 533: ["basename"]=>
! 534: string(9) "inet.h "
! 535: ["extension"]=>
! 536: string(4) "h "
! 537: ["filename"]=>
! 538: string(4) "inet"
! 539: }
! 540: -- Iteration 35 --
! 541: string(20) " /usr/include/arpa"
! 542: string(9) "inet.h "
! 543: string(4) "h "
! 544: string(4) "inet"
! 545: array(4) {
! 546: ["dirname"]=>
! 547: string(20) " /usr/include/arpa"
! 548: ["basename"]=>
! 549: string(9) "inet.h "
! 550: ["extension"]=>
! 551: string(4) "h "
! 552: ["filename"]=>
! 553: string(4) "inet"
! 554: }
! 555: -- Iteration 36 --
! 556: string(1) "."
! 557: string(3) " c:"
! 558: string(0) ""
! 559: string(3) " c:"
! 560: array(3) {
! 561: ["dirname"]=>
! 562: string(1) "."
! 563: ["basename"]=>
! 564: string(3) " c:"
! 565: ["filename"]=>
! 566: string(3) " c:"
! 567: }
! 568: -- Iteration 37 --
! 569: string(14) " c:\test\adir"
! 570: string(9) "afile.txt"
! 571: string(3) "txt"
! 572: string(5) "afile"
! 573: array(4) {
! 574: ["dirname"]=>
! 575: string(14) " c:\test\adir"
! 576: ["basename"]=>
! 577: string(9) "afile.txt"
! 578: ["extension"]=>
! 579: string(3) "txt"
! 580: ["filename"]=>
! 581: string(5) "afile"
! 582: }
! 583: -- Iteration 38 --
! 584: string(1) "\"
! 585: string(3) "usr"
! 586: string(0) ""
! 587: string(3) "usr"
! 588: array(3) {
! 589: ["dirname"]=>
! 590: string(1) "\"
! 591: ["basename"]=>
! 592: string(3) "usr"
! 593: ["filename"]=>
! 594: string(3) "usr"
! 595: }
! 596: -- Iteration 39 --
! 597: string(1) "\"
! 598: string(3) "usr"
! 599: string(0) ""
! 600: string(3) "usr"
! 601: array(3) {
! 602: ["dirname"]=>
! 603: string(1) "\"
! 604: ["basename"]=>
! 605: string(3) "usr"
! 606: ["filename"]=>
! 607: string(3) "usr"
! 608: }
! 609: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>