32 lines
982 B
Racket
32 lines
982 B
Racket
#lang racket
|
|
|
|
(require rackunit
|
|
racket/file
|
|
(only-in racket-makefile rm-f rm-rf cleanup))
|
|
|
|
(define tmp (make-temporary-file "racket-makefile-test~a" 'directory))
|
|
|
|
(dynamic-wind
|
|
void
|
|
(lambda ()
|
|
(define file (build-path tmp "x.tmp"))
|
|
(call-with-output-file file (lambda (out) (display "x" out)))
|
|
(check-true (file-exists? file))
|
|
(rm-f file)
|
|
(check-false (file-exists? file))
|
|
|
|
(define nested (build-path tmp "a" "b"))
|
|
(make-directory* nested)
|
|
(define html (build-path nested "x.html"))
|
|
(define txt (build-path nested "x.txt"))
|
|
(call-with-output-file html (lambda (out) (display "html" out)))
|
|
(call-with-output-file txt (lambda (out) (display "txt" out)))
|
|
(cleanup tmp '("**.html"))
|
|
(check-false (file-exists? html))
|
|
(check-true (file-exists? txt))
|
|
|
|
(rm-rf (build-path tmp "a"))
|
|
(check-false (directory-exists? (build-path tmp "a"))))
|
|
(lambda ()
|
|
(delete-directory/files tmp #:must-exist? #f)))
|