Mercurial > vim
annotate src/testdir/test_expr_utf8.vim @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 81ba6e4eb72b |
children | 2dcaa860e3fc |
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 |
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_strgetchar() |
8909
6393ac6d7060
commit https://github.com/vim/vim/commit/b22bd46b9681d73d095f2eadff8163d3a6cf416b
Christian Brabandt <cb@256bit.org>
parents:
8895
diff
changeset
|
7 call assert_equal(char2nr('á'), strgetchar('áxb', 0)) |
6393ac6d7060
commit https://github.com/vim/vim/commit/b22bd46b9681d73d095f2eadff8163d3a6cf416b
Christian Brabandt <cb@256bit.org>
parents:
8895
diff
changeset
|
8 call assert_equal(char2nr('x'), strgetchar('áxb', 1)) |
8895
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
8909
6393ac6d7060
commit https://github.com/vim/vim/commit/b22bd46b9681d73d095f2eadff8163d3a6cf416b
Christian Brabandt <cb@256bit.org>
parents:
8895
diff
changeset
|
10 call assert_equal(char2nr('a'), strgetchar('àxb', 0)) |
6393ac6d7060
commit https://github.com/vim/vim/commit/b22bd46b9681d73d095f2eadff8163d3a6cf416b
Christian Brabandt <cb@256bit.org>
parents:
8895
diff
changeset
|
11 call assert_equal(char2nr('̀'), strgetchar('àxb', 1)) |
6393ac6d7060
commit https://github.com/vim/vim/commit/b22bd46b9681d73d095f2eadff8163d3a6cf416b
Christian Brabandt <cb@256bit.org>
parents:
8895
diff
changeset
|
12 call assert_equal(char2nr('x'), strgetchar('àxb', 2)) |
8911
460c8cc144f0
commit https://github.com/vim/vim/commit/5d18e0eca59ffbba22c7f7c91c9f99d672095728
Christian Brabandt <cb@256bit.org>
parents:
8909
diff
changeset
|
13 |
460c8cc144f0
commit https://github.com/vim/vim/commit/5d18e0eca59ffbba22c7f7c91c9f99d672095728
Christian Brabandt <cb@256bit.org>
parents:
8909
diff
changeset
|
14 call assert_equal(char2nr('あ'), strgetchar('あaい', 0)) |
460c8cc144f0
commit https://github.com/vim/vim/commit/5d18e0eca59ffbba22c7f7c91c9f99d672095728
Christian Brabandt <cb@256bit.org>
parents:
8909
diff
changeset
|
15 call assert_equal(char2nr('a'), strgetchar('あaい', 1)) |
460c8cc144f0
commit https://github.com/vim/vim/commit/5d18e0eca59ffbba22c7f7c91c9f99d672095728
Christian Brabandt <cb@256bit.org>
parents:
8909
diff
changeset
|
16 call assert_equal(char2nr('い'), strgetchar('あaい', 2)) |
8895
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 endfunc |
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 func Test_strcharpart() |
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal('áxb', strcharpart('áxb', 0)) |
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal('á', strcharpart('áxb', 0, 1)) |
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 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
|
23 |
8993
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
24 call assert_equal('いうeお', strcharpart('あいうeお', 1)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
25 call assert_equal('い', strcharpart('あいうeお', 1, 1)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
26 call assert_equal('いう', strcharpart('あいうeお', 1, 2)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
27 call assert_equal('いうe', strcharpart('あいうeお', 1, 3)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
28 call assert_equal('いうeお', strcharpart('あいうeお', 1, 4)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
29 call assert_equal('eお', strcharpart('あいうeお', 3)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
30 call assert_equal('e', strcharpart('あいうeお', 3, 1)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
31 |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
32 call assert_equal('あ', strcharpart('あいうeお', -3, 4)) |
2085167ab1b0
commit https://github.com/vim/vim/commit/fca66003053f8c0da5161d1fe4b75b3a389934b5
Christian Brabandt <cb@256bit.org>
parents:
8911
diff
changeset
|
33 |
8895
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 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
|
35 call assert_equal('̀', strcharpart('àxb', 1, 1)) |
7f29248d5789
commit https://github.com/vim/vim/commit/0f518a8f4d4be4cac10389680f6bd5e3781f94b0
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 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
|
37 endfunc |