dir-dir.lisp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. (in-package :translator-test)
  2. (def-test-method dir-dir-test ((test fs-test))
  3. (with-testport (file (file-name-lookup (concatenate-string
  4. +main-dir+
  5. "/a")))
  6. (multiple-value-bind (ret err)
  7. (dir-rmdir file "thing")
  8. (assert-equal ret nil)
  9. (assert-equal err :not-directory))
  10. (multiple-value-bind (ret err)
  11. (dir-mkdir file "thingy")
  12. (assert-equal ret nil)
  13. (assert-equal err :not-directory)))
  14. (with-testport (dir (file-name-lookup +main-dir+))
  15. (multiple-value-bind (ret err)
  16. (dir-rmdir dir "mydir")
  17. (assert-equal ret nil)
  18. (assert-equal err :no-such-file))
  19. (multiple-value-bind (ret err)
  20. (dir-rmdir dir "a")
  21. (assert-equal ret nil)
  22. (assert-equal err :not-directory))
  23. (multiple-value-bind (ret err)
  24. (dir-rmdir dir "dir1")
  25. (assert-equal ret nil)
  26. (assert-equal err :directory-not-empty))
  27. (assert-true (dir-mkdir dir "mydir"))
  28. (with-testport (newdir (file-name-lookup
  29. (concatenate-string
  30. +main-dir+
  31. "/mydir")))
  32. (assert-true (is-dir-p (io-stat newdir))))
  33. (assert-true (dir-rmdir dir "mydir"))))