aboutsummaryrefslogtreecommitdiff
path: root/test/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'test/legacy')
-rw-r--r--test/legacy/002_filename_recognition_spec.lua42
-rw-r--r--test/legacy/test2-filename-recognition.vroom40
2 files changed, 42 insertions, 40 deletions
diff --git a/test/legacy/002_filename_recognition_spec.lua b/test/legacy/002_filename_recognition_spec.lua
new file mode 100644
index 0000000000..569e748631
--- /dev/null
+++ b/test/legacy/002_filename_recognition_spec.lua
@@ -0,0 +1,42 @@
+-- Test if URLs are recognized as filenames by commands such as "gf". Here
+-- we'll use `expand("<cfile>")` since "gf" would need to open the file.
+
+local helpers = require('test.functional.helpers')
+local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
+local execute, expect = helpers.execute, helpers.expect
+
+describe('filename recognition', function()
+ setup(clear)
+
+ it('is working', function()
+ -- insert some lines containing URLs
+ insert([[
+ first test for URL://machine.name/tmp/vimtest2a and other text
+ second test for URL://machine.name/tmp/vimtest2b. And other text
+ third test for URL:\\machine.name\vimtest2c and other text
+ fourth test for URL:\\machine.name\tmp\vimtest2d, and other text]])
+
+ -- Go to the first URL and append it to the beginning
+ execute('/^first', '/tmp', 'call append(0, expand("<cfile>"))')
+
+ -- Repeat for the second URL
+ -- this time, navigate to the word "URL" instead of "tmp"
+ execute('/^second', '/URL', 'call append(1, expand("<cfile>"))')
+
+ -- Repeat for the remaining URLs. This time, the 'isfname' option must be
+ -- set to allow '\' in filenames
+ execute('set isf=@,48-57,/,.,-,_,+,,,$,:,~,\\')
+ execute('/^third', '/name', 'call append(2, expand("<cfile>"))')
+ execute('/^fourth', '/URL', 'call append(3, expand("<cfile>"))')
+
+ -- Delete the initial text, which now starts at line 5
+ feed('5GdG')
+
+ -- The buffer should now contain:
+ expect([[
+ URL://machine.name/tmp/vimtest2a
+ URL://machine.name/tmp/vimtest2b
+ URL:\\machine.name\vimtest2c
+ URL:\\machine.name\tmp\vimtest2d]])
+ end)
+end)
diff --git a/test/legacy/test2-filename-recognition.vroom b/test/legacy/test2-filename-recognition.vroom
deleted file mode 100644
index b8169ec207..0000000000
--- a/test/legacy/test2-filename-recognition.vroom
+++ /dev/null
@@ -1,40 +0,0 @@
-Test if URLs are recognized as filenames by commands such as "gf". Here
-we'll use `expand("<cfile>")` since "gf" would need to open the file.
-
-Insert some URLs:
-
- % first test for URL://machine.name/tmp/vimtest2a and other text<cr>
- % second test for URL://machine.name/tmp/vimtest2b. And other text<cr>
- % third test for URL:\\machine.name\vimtest2c and other text<cr>
- % fourth test for URL:\\machine.name\tmp\vimtest2d, and other text
-
-Go to the first URL:
-
- :/^first<cr>/tmp
-
-Append the url to the beginning of the buffer:
-
- :call append(0, expand("<cfile>"))
-
-Repeat for the second URL, but navigate to the 'URL' word:
-
- :/^second<cr>/URL<cr>:call append(1, expand("<cfile>"))
-
-Repeat for the other two, but first the 'isfname' option must be set to
-allow '\' in filenames
-
- :set isf=@,48-57,/,.,-,_,+,,,$,:,~,\
- :/^third<cr>/name<cr>:call append(2, expand("<cfile>"))
- :/^fourth<cr>/URL<cr>:call append(3, expand("<cfile>"))
-
-Delete the initial text which starts at line 5:
-
- > 5GdG
-
-Result:
-
- URL://machine.name/tmp/vimtest2a
- URL://machine.name/tmp/vimtest2b
- URL:\\machine.name\vimtest2c
- URL:\\machine.name\tmp\vimtest2d
- @end