From 2faed269f37cd18a34d60bd3fe4841852b8912c6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Wed, 18 Jun 2014 23:28:57 -0600 Subject: [PATCH] windows: add test for links with foward slashes --- .../racket-test/tests/racket/win-link.rkt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pkgs/racket-pkgs/racket-test/tests/racket/win-link.rkt b/pkgs/racket-pkgs/racket-test/tests/racket/win-link.rkt index c14088a51d..d01393f5a0 100644 --- a/pkgs/racket-pkgs/racket-test/tests/racket/win-link.rkt +++ b/pkgs/racket-pkgs/racket-test/tests/racket/win-link.rkt @@ -120,10 +120,33 @@ (delete-file (build-path sub "f4")) (delete-file (build "l3")) + ;; Forward slashes (ok for absolute, not ok for relative) + (define abs? (absolute-path? (rbuild "t1"))) + (define ssq? (and (path? (rbuild "t1")) + (equal? "\\\\?\\" + (substring (path->string (rbuild "t1")) 0 4)))) + (make-file-or-directory-link (let ([p (rbuild "t1")]) + (if (path? p) + (let ([p (build-path p "f5")]) + (if ssq? + p + (bytes->path + (regexp-replace #rx"\\" (path->bytes p) "/")))) + (string-append p "/f5"))) + (build "l5")) + (call-with-output-file (build-path (tbuild "t1") "f5") void) + (test (or abs? ssq?) (file-exists? (build "l5"))) + (delete-file (build-path (tbuild "t1") "f5")) + (make-directory (build-path (tbuild "t1") "f5")) + (test (or abs? ssq?) (directory-exists? (build "l5"))) + (delete-directory (build-path (tbuild "t1") "f5")) + (delete-file (build "l5")) + (delete-directory/files (tbuild "t1")) (test #f (directory-exists? (build "l1"))) (test #f (file-exists? (build-path (build "l1") "f"))) + ;; Check some extra functions on files: (call-with-output-file (tbuild "t1") (lambda (o) (display "t1" o))) (test "t1" (file->string (build "l1")))