aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/vim_spec.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-10-22 22:48:46 -0700
committerMichael Lingelbach <m.j.lbach@gmail.com>2021-10-24 03:35:38 -0700
commitd752cbc4d2ef67686acb4bbe06e8cdfa79aa23f8 (patch)
tree59d04e7eaf33194d88defa1682d472673b7af7fc /test/functional/lua/vim_spec.lua
parentcb15055c294e6ebb9b2a65041cbff0a79cd3e69e (diff)
downloadrneovim-d752cbc4d2ef67686acb4bbe06e8cdfa79aa23f8.tar.gz
rneovim-d752cbc4d2ef67686acb4bbe06e8cdfa79aa23f8.tar.bz2
rneovim-d752cbc4d2ef67686acb4bbe06e8cdfa79aa23f8.zip
feat: add vim.str_utf_pos function
vim.str_utf_pos returns the codepoints for all utf-8 chars (only, currently) in a string
Diffstat (limited to 'test/functional/lua/vim_spec.lua')
-rw-r--r--test/functional/lua/vim_spec.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/functional/lua/vim_spec.lua b/test/functional/lua/vim_spec.lua
index 3123063b8c..8c691b1121 100644
--- a/test/functional/lua/vim_spec.lua
+++ b/test/functional/lua/vim_spec.lua
@@ -179,6 +179,12 @@ describe('lua stdlib', function()
end
end)
+ it("vim.str_utf_pos", function()
+ exec_lua([[_G.test_text = "xy åäö ɧ 汉语 ↥ 🤦x🦄 å بِيَّ"]])
+ local expected_positions = { 1,2,3,4,6,8,10,11,13,14,17,20,21,24,25,29,30,34,35,36,38,39,41,43,45,47 }
+ eq(expected_positions, exec_lua("return vim.str_utf_pos(_G.test_text)"))
+ end)
+
it("vim.schedule", function()
exec_lua([[
test_table = {}