From c51ae9ce18fecf0deb8c802fb5b5385fd670557c Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Sat, 20 Jun 2015 14:36:28 +0200 Subject: [PATCH 2/3] Skip symlink tests in find-files test on Windows, which can't handle symlinks --- tests/test-find-files.scm | 82 ++++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/tests/test-find-files.scm b/tests/test-find-files.scm index 891ab92..c3ef3e4 100644 --- a/tests/test-find-files.scm +++ b/tests/test-find-files.scm @@ -23,26 +23,30 @@ (change-directory "find-files-test-dir") -(create-symbolic-link "dir-link-target" "dir-link-name") +(cond-expand + ((and windows (not cygwin))) ; Cannot handle symlinks + (else (create-symbolic-link "dir-link-target" "dir-link-name"))) (test-begin "find-files") (test-equal "no keyword args" (find-files ".") - '("./foo/bar/baz" + `("./foo/bar/baz" "./foo/bar" "./foo" "./dir-link-target/foo" "./dir-link-target/bar" "./dir-link-target" "./file1" - "./dir-link-name" + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name"))) "./file2") file-list=?) (test-equal "dotfiles: #t" (find-files "." dotfiles: #t) - '("./foo/bar/baz/.quux" + `("./foo/bar/baz/.quux" "./foo/bar/baz" "./foo/bar" "./foo/.x" @@ -51,108 +55,126 @@ "./dir-link-target/bar" "./dir-link-target" "./file1" - "./dir-link-name" + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name"))) "./file2") file-list=?) (test-equal "follow-symlinks: #t" (find-files "." follow-symlinks: #t) - '("./foo/bar/baz" + `("./foo/bar/baz" "./foo/bar" "./foo" "./dir-link-target/foo" "./dir-link-target/bar" "./dir-link-target" "./file1" - "./dir-link-name/foo" - "./dir-link-name/bar" - "./dir-link-name" + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name/foo" + "./dir-link-name/bar" + "./dir-link-name"))) "./file2") file-list=?) (test-equal "limit: 1" (find-files "." limit: 1) - '("./foo/bar" + `("./foo/bar" "./foo" "./dir-link-target/foo" "./dir-link-target/bar" "./dir-link-target" "./file1" - "./dir-link-name" + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name"))) "./file2") file-list=?) (test-equal "limit: 1 follow-symlinks: #t" (find-files "." limit: 1 follow-symlinks: #t) - '("./foo/bar" + `("./foo/bar" "./foo" "./dir-link-target/foo" "./dir-link-target/bar" "./dir-link-target" "./file1" - "./dir-link-name/foo" - "./dir-link-name/bar" - "./dir-link-name" + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name/foo" + "./dir-link-name/bar" + "./dir-link-name"))) "./file2") file-list=?) (test-equal "limit: 2" (find-files "." limit: 2) - '("./foo/bar/baz" + `("./foo/bar/baz" "./foo/bar" "./foo" "./dir-link-target/foo" "./dir-link-target/bar" "./dir-link-target" "./file1" - "./dir-link-name" + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name"))) "./file2") file-list=?) (test-equal "limit: 2 follow-symlinks: #t" (find-files "." limit: 2 follow-symlinks: #t) - '("./foo/bar/baz" + `("./foo/bar/baz" "./foo/bar" "./foo" "./dir-link-target/foo" "./dir-link-target/bar" "./dir-link-target" "./file1" - "./dir-link-name/foo" - "./dir-link-name/bar" - "./dir-link-name" + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name/foo" + "./dir-link-name/bar" + "./dir-link-name"))) "./file2") file-list=?) (test-equal "test: (lambda (f) (directory? f))" (find-files "." test: (lambda (f) (directory? f))) - '("./foo/bar/baz" + `("./foo/bar/baz" "./foo/bar" "./foo" "./dir-link-target" - "./dir-link-name") + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name")))) file-list=?) (test-equal "test: (lambda (f) (directory? f)) action: (lambda (f p) (cons (string-append \"--\" f) p))" (find-files "." test: (lambda (f) (directory? f)) action: (lambda (f p) (cons (string-append "--" f) p))) - '("--./foo/bar/baz" + `("--./foo/bar/baz" "--./foo/bar" "--./foo" "--./dir-link-target" - "--./dir-link-name") + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("--./dir-link-name")))) file-list=?) (test-equal "dotfiles: #t test: (lambda (f) (directory? f)) follow-symlinks: #t" (find-files "." dotfiles: #t test: (lambda (f) (directory? f)) follow-symlinks: #t) - '("./foo/bar/baz/.quux" + `("./foo/bar/baz/.quux" "./foo/bar/baz" "./foo/bar" "./foo/.x" "./foo" "./dir-link-target" - "./dir-link-name") + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name")))) file-list=?) (test-equal "dotfiles: #t test: (lambda (f) (directory? f)) follow-symlinks: #t limit: 1" @@ -161,11 +183,13 @@ test: (lambda (f) (directory? f)) follow-symlinks: #t limit: 1) - '("./foo/bar" + `("./foo/bar" "./foo/.x" "./foo" "./dir-link-target" - "./dir-link-name") + ,@(cond-expand + ((and windows (not cygwin)) '()) + (else '("./dir-link-name")))) file-list=?) (test-end "find-files") -- 2.1.4