aboutsummaryrefslogtreecommitdiff
path: root/test/legacy/002_filename_recognition_spec.lua
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-09-29 09:43:52 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-09-30 17:37:16 -0300
commit42d5b526b9cbd067509e68ce6514a37e04df928a (patch)
tree0f5883a0dd231ed42222bf79ccb4cac7392de318 /test/legacy/002_filename_recognition_spec.lua
parent4b0f524915ee0e94bf9ca24fb1c1014921e610d5 (diff)
downloadrneovim-42d5b526b9cbd067509e68ce6514a37e04df928a.tar.gz
rneovim-42d5b526b9cbd067509e68ce6514a37e04df928a.tar.bz2
rneovim-42d5b526b9cbd067509e68ce6514a37e04df928a.zip
test: Replace vroom by lua/busted for functional tests
The 'lupa' python package provides a simple way to seamless integrate lua and python code. This commit replaces vroom by a python script that exposes the 'neovim' package to a lua state, and invokes busted to run functional tests. This is a temporary solution that will enable writing functional tests using lua/bused while a lua client library is not available. The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style syntax while also providing the customization power of a full programming language. Another reason is to use a single framework for unit/functional tests. Two other changes were performed in this commit: - Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now identified by "gcc/gcc-32". They will run unit/functional tests for both 64 and 32 bits. - Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
Diffstat (limited to 'test/legacy/002_filename_recognition_spec.lua')
-rw-r--r--test/legacy/002_filename_recognition_spec.lua42
1 files changed, 42 insertions, 0 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)