2
0

tdir.pp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. { Program to test OS-specific features of the system unit }
  2. { routines to test: }
  3. { mkdir() }
  4. { chdir() }
  5. { This program shoulf not be executed in a root directory }
  6. { Creates the following directory, and sets it as the }
  7. { current directory. }
  8. { ../testdir }
  9. Program tdir;
  10. {$I-}
  11. procedure test(value, required: longint);
  12. begin
  13. if value <> required then
  14. begin
  15. writeln('Got ',value,' instead of ',required);
  16. halt(1);
  17. end;
  18. end;
  19. var
  20. s: string;
  21. Begin
  22. Write('changing to parent directory...');
  23. chdir('..');
  24. test(IOResult, 0);
  25. WriteLn('Passed!');
  26. Write('making directory...');
  27. mkdir('testdir');
  28. test(IOResult, 0);
  29. WriteLn('Passed!');
  30. Write('going into the newly created directory...');
  31. chdir('testdir');
  32. test(IOResult, 0);
  33. WriteLn('Passed!');
  34. Write('making directory...');
  35. mkdir('testdir2');
  36. test(IOResult, 0);
  37. WriteLn('Passed!');
  38. Write('removing directory ...');
  39. rmdir('testdir2');
  40. test(IOResult, 0);
  41. WriteLn('Passed!');
  42. Write('going directory up ...');
  43. chdir('..');
  44. test(IOResult, 0);
  45. WriteLn('Passed!');
  46. Write('removing directory ...');
  47. rmdir('testdir');
  48. test(IOResult, 0);
  49. WriteLn('Passed!');
  50. WriteLn('getting current directory...');
  51. getdir(0,s);
  52. WriteLn(s);
  53. end.
  54. {
  55. $Log$
  56. Revision 1.4 2002-09-07 15:40:56 peter
  57. * old logs removed and tabs fixed
  58. Revision 1.3 2002/03/05 21:54:22 carl
  59. + cleanup
  60. }