diff options
| author | Michael Albinus | 2015-05-27 15:48:13 +0200 |
|---|---|---|
| committer | Michael Albinus | 2015-05-27 15:48:13 +0200 |
| commit | abf082383aca563ff8615f695c9f2accb6ac222d (patch) | |
| tree | b64befad969cb20eee69cfec89cc4e801c91fc87 /test | |
| parent | 3953c4be2816537be95520605d45b866dc731f4b (diff) | |
| download | emacs-abf082383aca563ff8615f695c9f2accb6ac222d.tar.gz emacs-abf082383aca563ff8615f695c9f2accb6ac222d.zip | |
New test tramp-test30-make-auto-save-file-name
* tramp-tests.el (tramp-test30-make-auto-save-file-name): New test.
(tramp-test31-special-characters)
(tramp-test31-special-characters-with-stat)
(tramp-test31-special-characters-with-perl)
(tramp-test31-special-characters-with-ls, tramp-test32-utf8)
(tramp-test32-utf8-with-stat, tramp-test32-utf8-with-perl)
(tramp-test32-utf8-with-ls, tramp-test33-asynchronous-requests)
(tramp-test34-recursive-load, tramp-test35-unload): Rename.
Diffstat (limited to 'test')
| -rw-r--r-- | test/automated/tramp-tests.el | 106 |
1 files changed, 94 insertions, 12 deletions
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 5bb05dce19a..84b2ab8db18 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el | |||
| @@ -1523,6 +1523,89 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1523 | 1523 | ||
| 1524 | (ignore-errors (delete-directory tmp-name1 'recursive))))) | 1524 | (ignore-errors (delete-directory tmp-name1 'recursive))))) |
| 1525 | 1525 | ||
| 1526 | (ert-deftest tramp-test30-make-auto-save-file-name () | ||
| 1527 | "Check `make-auto-save-file-name'." | ||
| 1528 | (skip-unless (tramp--test-enabled)) | ||
| 1529 | |||
| 1530 | (let ((tmp-name1 (tramp--test-make-temp-name)) | ||
| 1531 | (tmp-name2 (tramp--test-make-temp-name))) | ||
| 1532 | |||
| 1533 | (unwind-protect | ||
| 1534 | (progn | ||
| 1535 | ;; Use default `auto-save-file-name-transforms' mechanism. | ||
| 1536 | (let (tramp-auto-save-directory) | ||
| 1537 | (with-temp-buffer | ||
| 1538 | (setq buffer-file-name tmp-name1) | ||
| 1539 | (should | ||
| 1540 | (string-equal | ||
| 1541 | (make-auto-save-file-name) | ||
| 1542 | ;; This is taken from original `make-auto-save-file-name'. | ||
| 1543 | (expand-file-name | ||
| 1544 | (format | ||
| 1545 | "#%s#" | ||
| 1546 | (subst-char-in-string | ||
| 1547 | ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) | ||
| 1548 | temporary-file-directory))))) | ||
| 1549 | |||
| 1550 | ;; No mapping. | ||
| 1551 | (let (tramp-auto-save-directory auto-save-file-name-transforms) | ||
| 1552 | (with-temp-buffer | ||
| 1553 | (setq buffer-file-name tmp-name1) | ||
| 1554 | (should | ||
| 1555 | (string-equal | ||
| 1556 | (make-auto-save-file-name) | ||
| 1557 | (expand-file-name | ||
| 1558 | (format "#%s#" (file-name-nondirectory tmp-name1)) | ||
| 1559 | tramp-test-temporary-file-directory))))) | ||
| 1560 | |||
| 1561 | ;; Use default `tramp-auto-save-directory' mechanism. | ||
| 1562 | (let ((tramp-auto-save-directory tmp-name2)) | ||
| 1563 | (with-temp-buffer | ||
| 1564 | (setq buffer-file-name tmp-name1) | ||
| 1565 | (should | ||
| 1566 | (string-equal | ||
| 1567 | (make-auto-save-file-name) | ||
| 1568 | ;; This is taken from Tramp. | ||
| 1569 | (expand-file-name | ||
| 1570 | (format | ||
| 1571 | "#%s#" | ||
| 1572 | (tramp-subst-strs-in-string | ||
| 1573 | '(("_" . "|") | ||
| 1574 | ("/" . "_a") | ||
| 1575 | (":" . "_b") | ||
| 1576 | ("|" . "__") | ||
| 1577 | ("[" . "_l") | ||
| 1578 | ("]" . "_r")) | ||
| 1579 | tmp-name1)) | ||
| 1580 | tmp-name2))) | ||
| 1581 | (should (file-directory-p tmp-name2)))) | ||
| 1582 | |||
| 1583 | ;; Relative file names shall work, too. | ||
| 1584 | (let ((tramp-auto-save-directory ".")) | ||
| 1585 | (with-temp-buffer | ||
| 1586 | (setq buffer-file-name tmp-name1 | ||
| 1587 | default-directory tmp-name2) | ||
| 1588 | (should | ||
| 1589 | (string-equal | ||
| 1590 | (make-auto-save-file-name) | ||
| 1591 | ;; This is taken from Tramp. | ||
| 1592 | (expand-file-name | ||
| 1593 | (format | ||
| 1594 | "#%s#" | ||
| 1595 | (tramp-subst-strs-in-string | ||
| 1596 | '(("_" . "|") | ||
| 1597 | ("/" . "_a") | ||
| 1598 | (":" . "_b") | ||
| 1599 | ("|" . "__") | ||
| 1600 | ("[" . "_l") | ||
| 1601 | ("]" . "_r")) | ||
| 1602 | tmp-name1)) | ||
| 1603 | tmp-name2))) | ||
| 1604 | (should (file-directory-p tmp-name2))))) | ||
| 1605 | |||
| 1606 | (ignore-errors (delete-file tmp-name1)) | ||
| 1607 | (ignore-errors (delete-directory tmp-name2 'recursive))))) | ||
| 1608 | |||
| 1526 | (defun tramp--test-adb-p () | 1609 | (defun tramp--test-adb-p () |
| 1527 | "Check, whether the remote host runs Android. | 1610 | "Check, whether the remote host runs Android. |
| 1528 | This requires restrictions of file name syntax." | 1611 | This requires restrictions of file name syntax." |
| @@ -1701,13 +1784,13 @@ This requires restrictions of file name syntax." | |||
| 1701 | "{foo}bar{baz}")) | 1784 | "{foo}bar{baz}")) |
| 1702 | 1785 | ||
| 1703 | ;; These tests are inspired by Bug#17238. | 1786 | ;; These tests are inspired by Bug#17238. |
| 1704 | (ert-deftest tramp-test30-special-characters () | 1787 | (ert-deftest tramp-test31-special-characters () |
| 1705 | "Check special characters in file names." | 1788 | "Check special characters in file names." |
| 1706 | (skip-unless (tramp--test-enabled)) | 1789 | (skip-unless (tramp--test-enabled)) |
| 1707 | 1790 | ||
| 1708 | (tramp--test-special-characters)) | 1791 | (tramp--test-special-characters)) |
| 1709 | 1792 | ||
| 1710 | (ert-deftest tramp-test30-special-characters-with-stat () | 1793 | (ert-deftest tramp-test31-special-characters-with-stat () |
| 1711 | "Check special characters in file names. | 1794 | "Check special characters in file names. |
| 1712 | Use the `stat' command." | 1795 | Use the `stat' command." |
| 1713 | (skip-unless (tramp--test-enabled)) | 1796 | (skip-unless (tramp--test-enabled)) |
| @@ -1726,7 +1809,7 @@ Use the `stat' command." | |||
| 1726 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 1809 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 1727 | (tramp-set-connection-property v "perl" 'undef)))) | 1810 | (tramp-set-connection-property v "perl" 'undef)))) |
| 1728 | 1811 | ||
| 1729 | (ert-deftest tramp-test30-special-characters-with-perl () | 1812 | (ert-deftest tramp-test31-special-characters-with-perl () |
| 1730 | "Check special characters in file names. | 1813 | "Check special characters in file names. |
| 1731 | Use the `perl' command." | 1814 | Use the `perl' command." |
| 1732 | (skip-unless (tramp--test-enabled)) | 1815 | (skip-unless (tramp--test-enabled)) |
| @@ -1745,7 +1828,7 @@ Use the `perl' command." | |||
| 1745 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 1828 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 1746 | (tramp-set-connection-property v "stat" 'undef)))) | 1829 | (tramp-set-connection-property v "stat" 'undef)))) |
| 1747 | 1830 | ||
| 1748 | (ert-deftest tramp-test30-special-characters-with-ls () | 1831 | (ert-deftest tramp-test31-special-characters-with-ls () |
| 1749 | "Check special characters in file names. | 1832 | "Check special characters in file names. |
| 1750 | Use the `ls' command." | 1833 | Use the `ls' command." |
| 1751 | (skip-unless (tramp--test-enabled)) | 1834 | (skip-unless (tramp--test-enabled)) |
| @@ -1775,13 +1858,13 @@ Use the `ls' command." | |||
| 1775 | "银河系漫游指南系列" | 1858 | "银河系漫游指南系列" |
| 1776 | "Автостопом по гала́ктике"))) | 1859 | "Автостопом по гала́ктике"))) |
| 1777 | 1860 | ||
| 1778 | (ert-deftest tramp-test31-utf8 () | 1861 | (ert-deftest tramp-test32-utf8 () |
| 1779 | "Check UTF8 encoding in file names and file contents." | 1862 | "Check UTF8 encoding in file names and file contents." |
| 1780 | (skip-unless (tramp--test-enabled)) | 1863 | (skip-unless (tramp--test-enabled)) |
| 1781 | 1864 | ||
| 1782 | (tramp--test-utf8)) | 1865 | (tramp--test-utf8)) |
| 1783 | 1866 | ||
| 1784 | (ert-deftest tramp-test31-utf8-with-stat () | 1867 | (ert-deftest tramp-test32-utf8-with-stat () |
| 1785 | "Check UTF8 encoding in file names and file contents. | 1868 | "Check UTF8 encoding in file names and file contents. |
| 1786 | Use the `stat' command." | 1869 | Use the `stat' command." |
| 1787 | (skip-unless (tramp--test-enabled)) | 1870 | (skip-unless (tramp--test-enabled)) |
| @@ -1800,7 +1883,7 @@ Use the `stat' command." | |||
| 1800 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 1883 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 1801 | (tramp-set-connection-property v "perl" 'undef)))) | 1884 | (tramp-set-connection-property v "perl" 'undef)))) |
| 1802 | 1885 | ||
| 1803 | (ert-deftest tramp-test31-utf8-with-perl () | 1886 | (ert-deftest tramp-test32-utf8-with-perl () |
| 1804 | "Check UTF8 encoding in file names and file contents. | 1887 | "Check UTF8 encoding in file names and file contents. |
| 1805 | Use the `perl' command." | 1888 | Use the `perl' command." |
| 1806 | (skip-unless (tramp--test-enabled)) | 1889 | (skip-unless (tramp--test-enabled)) |
| @@ -1819,7 +1902,7 @@ Use the `perl' command." | |||
| 1819 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil | 1902 | (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil |
| 1820 | (tramp-set-connection-property v "stat" 'undef)))) | 1903 | (tramp-set-connection-property v "stat" 'undef)))) |
| 1821 | 1904 | ||
| 1822 | (ert-deftest tramp-test31-utf8-with-ls () | 1905 | (ert-deftest tramp-test32-utf8-with-ls () |
| 1823 | "Check UTF8 encoding in file names and file contents. | 1906 | "Check UTF8 encoding in file names and file contents. |
| 1824 | Use the `ls' command." | 1907 | Use the `ls' command." |
| 1825 | (skip-unless (tramp--test-enabled)) | 1908 | (skip-unless (tramp--test-enabled)) |
| @@ -1839,7 +1922,7 @@ Use the `ls' command." | |||
| 1839 | (tramp-set-connection-property v "perl" 'undef)))) | 1922 | (tramp-set-connection-property v "perl" 'undef)))) |
| 1840 | 1923 | ||
| 1841 | ;; This test is inspired by Bug#16928. | 1924 | ;; This test is inspired by Bug#16928. |
| 1842 | (ert-deftest tramp-test32-asynchronous-requests () | 1925 | (ert-deftest tramp-test33-asynchronous-requests () |
| 1843 | "Check parallel asynchronous requests. | 1926 | "Check parallel asynchronous requests. |
| 1844 | Such requests could arrive from timers, process filters and | 1927 | Such requests could arrive from timers, process filters and |
| 1845 | process sentinels. They shall not disturb each other." | 1928 | process sentinels. They shall not disturb each other." |
| @@ -1928,7 +2011,7 @@ process sentinels. They shall not disturb each other." | |||
| 1928 | (dolist (buf buffers) | 2011 | (dolist (buf buffers) |
| 1929 | (ignore-errors (kill-buffer buf))))))) | 2012 | (ignore-errors (kill-buffer buf))))))) |
| 1930 | 2013 | ||
| 1931 | (ert-deftest tramp-test33-recursive-load () | 2014 | (ert-deftest tramp-test34-recursive-load () |
| 1932 | "Check that Tramp does not fail due to recursive load." | 2015 | "Check that Tramp does not fail due to recursive load." |
| 1933 | (skip-unless (tramp--test-enabled)) | 2016 | (skip-unless (tramp--test-enabled)) |
| 1934 | 2017 | ||
| @@ -1951,7 +2034,7 @@ process sentinels. They shall not disturb each other." | |||
| 1951 | (mapconcat 'shell-quote-argument load-path " -L ") | 2034 | (mapconcat 'shell-quote-argument load-path " -L ") |
| 1952 | (shell-quote-argument code))))))) | 2035 | (shell-quote-argument code))))))) |
| 1953 | 2036 | ||
| 1954 | (ert-deftest tramp-test34-unload () | 2037 | (ert-deftest tramp-test35-unload () |
| 1955 | "Check that Tramp and its subpackages unload completely. | 2038 | "Check that Tramp and its subpackages unload completely. |
| 1956 | Since it unloads Tramp, it shall be the last test to run." | 2039 | Since it unloads Tramp, it shall be the last test to run." |
| 1957 | ;; Mark as failed until all symbols are unbound. | 2040 | ;; Mark as failed until all symbols are unbound. |
| @@ -1991,7 +2074,6 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 1991 | ;; * file-ownership-preserved-p | 2074 | ;; * file-ownership-preserved-p |
| 1992 | ;; * file-selinux-context | 2075 | ;; * file-selinux-context |
| 1993 | ;; * find-backup-file-name | 2076 | ;; * find-backup-file-name |
| 1994 | ;; * make-auto-save-file-name | ||
| 1995 | ;; * set-file-acl | 2077 | ;; * set-file-acl |
| 1996 | ;; * set-file-selinux-context | 2078 | ;; * set-file-selinux-context |
| 1997 | 2079 | ||