From cbb289e13eff6b187a942658971aa5419e3ed920 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 24 Jul 2015 20:02:59 +0200 Subject: [PATCH] Minor cleanup in tramp-tests.el * test/automated/tramp-tests.el (tramp-test31-*, tramp-test32-*): Implement using the documented interface `tramp-connection-properties', rather than with internal functions. --- test/automated/tramp-tests.el | 94 +++++++++++++++-------------------- 1 file changed, 41 insertions(+), 53 deletions(-) diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 6972373bdf2..a03dbf30b18 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -1695,7 +1695,7 @@ This requires restrictions of file name syntax." (defun tramp--test-hpux-p () "Check, whether the remote host runs HP-UX. Several special characters do not work properly there." - ;; We must refill the cache. + ;; We must refill the cache. `file-truename' does it. (with-parsed-tramp-file-name (file-truename tramp-test-temporary-file-directory) nil (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) @@ -1894,14 +1894,12 @@ Use the `stat' command." (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil (skip-unless (tramp-get-remote-stat v))) - (unwind-protect - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "perl" nil) - (tramp--test-special-characters)) - - ;; Reset suppressed properties. - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "perl" 'undef)))) + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil)) + tramp-connection-properties))) + (tramp--test-special-characters))) (ert-deftest tramp-test31-special-characters-with-perl () "Check special characters in file names. @@ -1914,14 +1912,12 @@ Use the `perl' command." (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil (skip-unless (tramp-get-remote-perl v))) - (unwind-protect - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" nil) - (tramp--test-special-characters)) - - ;; Reset suppressed properties. - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" 'undef)))) + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil)) + tramp-connection-properties))) + (tramp--test-special-characters))) (ert-deftest tramp-test31-special-characters-with-ls () "Check special characters in file names. @@ -1932,16 +1928,14 @@ Use the `ls' command." (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) 'tramp-sh-file-name-handler)) - (unwind-protect - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" nil) - (tramp-set-connection-property v "perl" nil) - (tramp--test-special-characters)) - - ;; Reset suppressed properties. - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" 'undef) - (tramp-set-connection-property v "perl" 'undef)))) + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil) + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil)) + tramp-connection-properties))) + (tramp--test-special-characters))) (defun tramp--test-utf8 () "Perform the test in `tramp-test32-utf8*'." @@ -1972,14 +1966,12 @@ Use the `stat' command." (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil (skip-unless (tramp-get-remote-stat v))) - (unwind-protect - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "perl" nil) - (tramp--test-utf8)) - - ;; Reset suppressed properties. - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "perl" 'undef)))) + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil)) + tramp-connection-properties))) + (tramp--test-utf8))) (ert-deftest tramp-test32-utf8-with-perl () "Check UTF8 encoding in file names and file contents. @@ -1992,14 +1984,12 @@ Use the `perl' command." (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil (skip-unless (tramp-get-remote-perl v))) - (unwind-protect - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" nil) - (tramp--test-utf8)) - - ;; Reset suppressed properties. - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" 'undef)))) + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil)) + tramp-connection-properties))) + (tramp--test-utf8))) (ert-deftest tramp-test32-utf8-with-ls () "Check UTF8 encoding in file names and file contents. @@ -2010,16 +2000,14 @@ Use the `ls' command." (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) 'tramp-sh-file-name-handler)) - (unwind-protect - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" nil) - (tramp-set-connection-property v "perl" nil) - (tramp--test-utf8)) - - ;; Reset suppressed properties. - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (tramp-set-connection-property v "stat" 'undef) - (tramp-set-connection-property v "perl" 'undef)))) + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil) + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil)) + tramp-connection-properties))) + (tramp--test-utf8))) ;; This test is inspired by Bug#16928. (ert-deftest tramp-test33-asynchronous-requests () -- 2.39.5