Skip to content

Commit

Permalink
Fix with-temp-file macro for CCL.
Browse files Browse the repository at this point in the history
  • Loading branch information
svetlyak40wt committed Jul 8, 2024
1 parent 82605a3 commit c734f2a
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions t/core.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@
(:import-from #:rove
#:deftest
#:ok)
(:import-from #:docs-builder))
(:import-from #:docs-builder)
(:import-from #:alexandria
#:once-only
#:with-gensyms))
(in-package #:40ants-project-templates-tests/core)


(defmacro with-temp-path ((lib-name tmp-path-var) &body body)
(alexandria:once-only (lib-name)
`(let ((,tmp-path-var (uiop:ensure-directory-pathname
(uiop:tmpize-pathname
(make-pathname :name ,lib-name
:directory '(:absolute "tmp"))))))
(uiop:delete-file-if-exists ,tmp-path-var)

(unwind-protect
(progn ,@body)
(when (probe-file ,tmp-path-var)
(uiop:delete-directory-tree ,tmp-path-var :validate t))))))
(with-gensyms (temp-file)
(once-only (lib-name)
`(let* ((,temp-file (uiop:tmpize-pathname
(make-pathname :name ,lib-name
:directory '(:absolute "tmp"))))
(,tmp-path-var (uiop:ensure-directory-pathname ,temp-file)))
(uiop:delete-file-if-exists ,temp-file)

(unwind-protect
(progn ,@body)
(when (probe-file ,tmp-path-var)
(uiop:delete-directory-tree ,tmp-path-var :validate t)))))))


(deftest test-a-library-has-docs
Expand Down

0 comments on commit c734f2a

Please sign in to comment.