Annotation of embedaddon/php/tests/run-test/test007.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: dirname test
! 3: --FILE--
! 4: <?php
! 5:
! 6: // Allow for either Win32 or Unix.
! 7: $s = dirname("/foo");
! 8: // $s should be either / (Unix) or \ (Win32)
! 9:
! 10: function check_dirname($path) {
! 11: global $s;
! 12: $path1 = str_replace("%",$s,$path);
! 13: $path2 = dirname($path1);
! 14: $path3 = str_replace($s,"%",$path2);
! 15: print "dirname($path) == $path3\n";
! 16: }
! 17:
! 18: check_dirname("%foo%");
! 19: check_dirname("%foo");
! 20: check_dirname("%foo%bar");
! 21: check_dirname("%");
! 22: check_dirname("...%foo");
! 23: check_dirname(".%foo");
! 24: check_dirname("foobar%%%");
! 25: check_dirname("%\0%\0%\0.%\0.");
! 26:
! 27: function same($a,$b) {
! 28: if ($a == $b) {
! 29: print "OK\n";
! 30: } else {
! 31: print "FAIL $a == $b\n";
! 32: }
! 33: }
! 34:
! 35: if ('/' == $s) {
! 36: same(".",dirname("d:\\foo\\bar.inc"));
! 37: same(".",dirname("c:\\foo"));
! 38: same(".",dirname("c:\\"));
! 39: same(".",dirname("c:"));
! 40: } else {
! 41: same("d:\\foo",dirname("d:\\foo\\bar.inc"));
! 42: same("c:\\",dirname("c:\\foo"));
! 43: same("c:\\",dirname("c:\\"));
! 44: same("c:",dirname("c:"));
! 45: }
! 46:
! 47: ?>
! 48: --EXPECT--
! 49: dirname(%foo%) == %
! 50: dirname(%foo) == %
! 51: dirname(%foo%bar) == %foo
! 52: dirname(%) == %
! 53: dirname(...%foo) == ...
! 54: dirname(.%foo) == .
! 55: dirname(foobar%%%) == .
! 56: dirname(% % % .% .) == % % % .
! 57: OK
! 58: OK
! 59: OK
! 60: OK
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>