annotate src/testdir/test_expr_utf8.vim @ 8899:fe12294683d8 v7.4.1736

commit https://github.com/vim/vim/commit/baa9fcaf4042a6dbe01e64ce63cb54941ee00f09 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 14 17:40:56 2016 +0200 patch 7.4.1736 Problem: Unused variable. Solution: Remove it. (Yasuhiro Matsumoto)
author Christian Brabandt <cb@256bit.org>
date Thu, 14 Apr 2016 17:45:05 +0200
parents 7f29248d5789
children 6393ac6d7060
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8895
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for expressions using utf-8.
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 if !has('multi_byte')
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 finish
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 endif
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 set encoding=utf-8
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 scriptencoding utf-8
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 func Test_strgetchar()
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_equal(char2nr('a'), strgetchar('axb', 0))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call assert_equal(char2nr('x'), strgetchar('axb', 1))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 call assert_equal(char2nr('b'), strgetchar('axb', 2))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal(-1, strgetchar('axb', -1))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal(-1, strgetchar('axb', 3))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_equal(-1, strgetchar('', 0))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfunc
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 func Test_strcharpart()
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call assert_equal('áxb', strcharpart('áxb', 0))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal('á', strcharpart('áxb', 0, 1))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal('x', strcharpart('áxb', 1, 1))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call assert_equal('a', strcharpart('àxb', 0, 1))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call assert_equal('̀', strcharpart('àxb', 1, 1))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 call assert_equal('x', strcharpart('àxb', 2, 1))
7f29248d5789 commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 endfunc