refuse an output naming the source
-o naming the input wrote over it, whatever was asked for.
This commit is contained in:
@@ -98,6 +98,16 @@
|
||||
(test "and leaves no file named -" #f
|
||||
(file-exists? "-"))
|
||||
|
||||
;;; -o naming the source overwrote it, whatever was asked for
|
||||
(call-with-output-file "victim.sex" (lambda (p) (display hello-source p)))
|
||||
(test-assert "an output naming the source is refused"
|
||||
(let ((run (sexc-run #f "victim.sex" "-C" "-o" "./victim.sex")))
|
||||
(and (not (zero? (car run)))
|
||||
(substring-index "would overwrite its source" (caddr run))
|
||||
#t)))
|
||||
(test "and the source is as it was" hello-source
|
||||
(call-with-input-file "victim.sex" (lambda (p) (read-string #f p))))
|
||||
|
||||
(delete-directory scratch #t)
|
||||
|
||||
(test-exit)
|
||||
|
||||
Reference in New Issue
Block a user