aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/utf8_spec.lua
diff options
context:
space:
mode:
authorJurica Bradaric <jbradaric@gmail.com>2016-01-30 17:42:22 +0100
committerJustin M. Keyes <justinkz@gmail.com>2016-02-09 01:36:29 -0500
commita9a25fda42abdec267e89bf607f35e60806ec092 (patch)
tree91ff2f022e3a79ef13886b44c5479ff16a9944ba /test/functional/legacy/utf8_spec.lua
parent31aa060bca0084d19eac382408727c5f3b190af3 (diff)
downloadrneovim-a9a25fda42abdec267e89bf607f35e60806ec092.tar.gz
rneovim-a9a25fda42abdec267e89bf607f35e60806ec092.tar.bz2
rneovim-a9a25fda42abdec267e89bf607f35e60806ec092.zip
vim-patch:7.4.755
Problem: It is not easy to count the number of characters. Solution: Add the skipcc argument to strchars(). (Hirohito Higashi, Ken Takata) https://github.com/vim/vim/commit/641e48c2248ccb3c25a5cdaa3709f16152d8c77d
Diffstat (limited to 'test/functional/legacy/utf8_spec.lua')
-rw-r--r--test/functional/legacy/utf8_spec.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/legacy/utf8_spec.lua b/test/functional/legacy/utf8_spec.lua
index ef717042d0..c16b1c45f4 100644
--- a/test/functional/legacy/utf8_spec.lua
+++ b/test/functional/legacy/utf8_spec.lua
@@ -3,6 +3,7 @@
local helpers = require('test.functional.helpers')
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
local execute, expect = helpers.execute, helpers.expect
+local eq, eval = helpers.eq, helpers.eval
describe('utf8', function()
setup(clear)
@@ -27,4 +28,26 @@ describe('utf8', function()
xあああ
bxbb]])
end)
+
+ it('strchars()', function()
+ eq(1, eval('strchars("a")'))
+ eq(1, eval('strchars("a", 0)'))
+ eq(1, eval('strchars("a", 1)'))
+
+ eq(3, eval('strchars("あいa")'))
+ eq(3, eval('strchars("あいa", 0)'))
+ eq(3, eval('strchars("あいa", 1)'))
+
+ eq(2, eval('strchars("A\\u20dd")'))
+ eq(2, eval('strchars("A\\u20dd", 0)'))
+ eq(1, eval('strchars("A\\u20dd", 1)'))
+
+ eq(3, eval('strchars("A\\u20dd\\u20dd")'))
+ eq(3, eval('strchars("A\\u20dd\\u20dd", 0)'))
+ eq(1, eval('strchars("A\\u20dd\\u20dd", 1)'))
+
+ eq(1, eval('strchars("\\u20dd")'))
+ eq(1, eval('strchars("\\u20dd", 0)'))
+ eq(1, eval('strchars("\\u20dd", 1)'))
+ end)
end)