Skip to content

Commit ac105ed

Browse files
committed
patch 7.4.2086
Problem: Using the system default encoding makes tests unpredictable. Solution: Always use utf-8 or latin1 in the new style tests. Remove setting encoding and scriptencoding where it is not needed.
1 parent dfd63e3 commit ac105ed

11 files changed

Lines changed: 14 additions & 20 deletions

src/testdir/runtest.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ source setup.vim
4949
" This also enables use of line continuation.
5050
set nocp viminfo+=nviminfo
5151

52+
" Use utf-8 or latin1 be default, instead of whatever the system default
53+
" happens to be. Individual tests can overrule this at the top of the file.
54+
if has('multi_byte')
55+
set encoding=utf-8
56+
else
57+
set encoding=latin1
58+
endif
59+
5260
" Avoid stopping at the "hit enter" prompt
5361
set nomore
5462

src/testdir/test_alot_utf8.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
" A series of tests that can run in one Vim invocation.
22
" This makes testing go faster, since Vim doesn't need to restart.
33

4-
" These tests use utf8 'encoding'. Setting 'encoding' is in the individual
4+
" These tests use utf8 'encoding'. Setting 'encoding' is already done in
5+
" runtest.vim. Checking for the multi_byte feature is in the individual
56
" files, so that they can be run by themselves.
67

78
source test_expr_utf8.vim

src/testdir/test_channel.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
" Test for channel functions.
2-
scriptencoding utf-8
32

43
if !has('channel')
54
finish

src/testdir/test_digraph.vim

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ if !has("digraphs") || !has("multi_byte")
44
finish
55
endif
66

7-
set enc=utf-8
8-
scriptencoding utf-8
9-
107
func! Put_Dig(chars)
118
exe "norm! o\<c-k>".a:chars
129
endfu

src/testdir/test_expand_dllpath.vim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
scriptencoding utf-8
2-
31
func s:test_expand_dllpath(optname)
42
let $TEST_EXPAND_DLLPATH = '/dllpath/lib' . substitute(a:optname, '\zedll$', '.', '')
53
execute 'let dllpath_save = &' . a:optname

src/testdir/test_expr_utf8.vim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
if !has('multi_byte')
33
finish
44
endif
5-
set encoding=utf-8
6-
scriptencoding utf-8
75

86
func Test_strgetchar()
97
call assert_equal(char2nr('á'), strgetchar('áxb', 0))

src/testdir/test_json.vim

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
" Test for JSON functions.
22

3-
" JSON requires using utf-8. Conversion breaks the asserts, therefore set
4-
" 'encoding' to utf-8.
3+
" JSON requires using utf-8, because conversion breaks the asserts.
54
if !has('multi_byte')
65
finish
76
endif
8-
set encoding=utf-8
9-
scriptencoding utf-8
107

118
let s:json1 = '"str\"in\\g"'
129
let s:var1 = "str\"in\\g"

src/testdir/test_matchadd_conceal_utf8.vim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
if !has('conceal') || !has('multi_byte')
33
finish
44
endif
5-
set encoding=utf-8
6-
scriptencoding utf-8
75

86
if !has('gui_running') && has('unix')
97
set term=ansi

src/testdir/test_regexp_utf8.vim

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
if !has('multi_byte')
33
finish
44
endif
5-
set encoding=utf-8
6-
scriptencoding utf-8
75

86
func s:equivalence_test()
97
let str = "AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐẔ aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ"

src/testdir/test_visual.vim

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
" Tests for Visual mode
1+
" Tests for Visual mode. Uses double-wide character.
22
if !has('multi_byte')
33
finish
44
endif
5-
set encoding=utf-8
6-
scriptencoding utf-8
75

86
if !has('visual')
97
finish

0 commit comments

Comments
 (0)