aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii2025-06-08 11:21:05 +0300
committerEli Zaretskii2025-06-08 11:21:05 +0300
commitff8c0648fb4dd67bfad44167e70f25a12b1149bd (patch)
tree54b97b54f5154e9c6e938d5dd7be4219311a233d /test
parentb7560fb63dce3a1c7cc7048ebcfca7c694e566d2 (diff)
downloademacs-ff8c0648fb4dd67bfad44167e70f25a12b1149bd.tar.gz
emacs-ff8c0648fb4dd67bfad44167e70f25a12b1149bd.zip
Fix 'ffap-string-at-point' under 'ffap-file-name-with-spaces'
* lisp/ffap.el (ffap-file-name-with-spaces): Doc fix. (ffap-string-at-point): Don't reject '~foo/' and 'd:/bar' file names when 'ffap-file-name-with-spaces' is non-nil. * test/lisp/ffap-tests.el (ffap-test-with-spaces): Add tests, and fix expected results to not strip Windows drive letters.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/ffap-tests.el32
1 files changed, 24 insertions, 8 deletions
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index 3c6e1e8e18e..ea5e745bfaf 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -105,7 +105,7 @@ left alone when opening a URL in an external browser."
105 (with-temp-buffer 105 (with-temp-buffer
106 (insert string) 106 (insert string)
107 (goto-char (point-min)) 107 (goto-char (point-min))
108 (forward-char 10) 108 (forward-char 3)
109 (ffap-string-at-point)))) 109 (ffap-string-at-point))))
110 110
111(ert-deftest ffap-test-with-spaces () 111(ert-deftest ffap-test-with-spaces ()
@@ -113,7 +113,7 @@ left alone when opening a URL in an external browser."
113 (equal 113 (equal
114 (ffap-test-string 114 (ffap-test-string
115 t "c:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program here.txt") 115 t "c:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program here.txt")
116 "/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program here.txt")) 116 "c:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program here.txt"))
117 (should 117 (should
118 (equal 118 (equal
119 (ffap-test-string 119 (ffap-test-string
@@ -122,23 +122,39 @@ left alone when opening a URL in an external browser."
122 (should 122 (should
123 (equal 123 (equal
124 (ffap-test-string 124 (ffap-test-string
125 t "c:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program Files/Hummingbird/") 125 t "z:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program Files/Hummingbird/")
126 "/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program Files/Hummingbird/")) 126 "z:/Program Files/Open Text Evaluation Media/Open Text Exceed 14 x86/Program Files/Hummingbird/"))
127 (should 127 (should
128 (equal 128 (equal
129 (ffap-test-string 129 (ffap-test-string
130 t "c:\\Program Files\\Open Text Evaluation Media\\Open Text Exceed 14 x86\\Program Files\\Hummingbird\\") 130 t "c:\\Program Files\\Open Text Evaluation Media\\Open Text Exceed 14 x86\\Program Files\\Hummingbird\\")
131 "\\Program Files\\Open Text Evaluation Media\\Open Text Exceed 14 x86\\Program Files\\Hummingbird\\")) 131 "c:\\Program Files\\Open Text Evaluation Media\\Open Text Exceed 14 x86\\Program Files\\Hummingbird\\"))
132 (should 132 (should
133 (equal 133 (equal
134 (ffap-test-string 134 (ffap-test-string
135 t "c:\\Program Files\\Freescale\\CW for MPC55xx and MPC56xx 2.10\\PowerPC_EABI_Tools\\Command_Line_Tools\\CLT_Usage_Notes.txt") 135 t "d:\\Program Files\\Freescale\\CW for MPC55xx and MPC56xx 2.10\\PowerPC_EABI_Tools\\Command_Line_Tools\\CLT_Usage_Notes.txt")
136 "\\Program Files\\Freescale\\CW for MPC55xx and MPC56xx 2.10\\PowerPC_EABI_Tools\\Command_Line_Tools\\CLT_Usage_Notes.txt")) 136 "d:\\Program Files\\Freescale\\CW for MPC55xx and MPC56xx 2.10\\PowerPC_EABI_Tools\\Command_Line_Tools\\CLT_Usage_Notes.txt"))
137 (should 137 (should
138 (equal 138 (equal
139 (ffap-test-string 139 (ffap-test-string
140 t "C:\\temp\\program.log on Windows or /var/log/program.log on Unix.") 140 t "C:\\temp\\program.log on Windows or /var/log/program.log on Unix.")
141 "\\temp\\program.log"))) 141 "C:\\temp\\program.log"))
142 (should
143 (equal
144 (ffap-test-string t "~/tmp/")
145 "~/tmp/"))
146 (should
147 (equal
148 (ffap-test-string nil "~/tmp/")
149 "~/tmp/"))
150 (should
151 (equal
152 (ffap-test-string t "~abc123_áè/foo")
153 "~abc123_áè/foo"))
154 (should
155 (equal
156 (ffap-test-string t "c:/Program Files/my program.exe and here's more text")
157 "c:/Program Files/my program.exe")))
142 158
143(ert-deftest ffap-test-no-newlines () 159(ert-deftest ffap-test-no-newlines ()
144 (should-not 160 (should-not