1" Test for :mksession, :mkview and :loadview in utf-8 encoding 2 3set encoding=utf-8 4scriptencoding utf-8 5 6source check.vim 7CheckFeature mksession 8 9func Test_mksession_utf8() 10 tabnew 11 let wrap_save = &wrap 12 set sessionoptions=buffers splitbelow fileencoding=utf-8 13 call setline(1, [ 14 \ 'start:', 15 \ 'no multibyte chAracter', 16 \ ' one leaDing tab', 17 \ ' four leadinG spaces', 18 \ 'two consecutive tabs', 19 \ 'two tabs in one line', 20 \ 'one … multibyteCharacter', 21 \ 'a “b” two multiByte characters', 22 \ '“c”1€ three mulTibyte characters' 23 \ ]) 24 let tmpfile = tempname() 25 exec 'w! ' . tmpfile 26 /^start: 27 set wrap 28 vsplit 29 norm! j16| 30 split 31 norm! j16| 32 split 33 norm! j16| 34 split 35 norm! j8| 36 split 37 norm! j8| 38 split 39 norm! j16| 40 split 41 norm! j16| 42 split 43 norm! j16| 44 wincmd l 45 46 set nowrap 47 /^start: 48 norm! j16|3zl 49 split 50 norm! j016|3zl 51 split 52 norm! j016|3zl 53 split 54 norm! j08|3zl 55 split 56 norm! j08|3zl 57 split 58 norm! j016|3zl 59 split 60 norm! j016|3zl 61 split 62 norm! j016|3zl 63 split 64 call wincol() 65 mksession! test_mks.out 66 let li = filter(readfile('test_mks.out'), 'v:val =~# "\\(^ *normal! 0\\|^ *exe ''normal!\\)"') 67 let expected =<< trim [DATA] 68 normal! 016| 69 normal! 016| 70 normal! 016| 71 normal! 08| 72 normal! 08| 73 normal! 016| 74 normal! 016| 75 normal! 016| 76 exe 'normal! ' . s:c . '|zs' . 16 . '|' 77 normal! 016| 78 exe 'normal! ' . s:c . '|zs' . 16 . '|' 79 normal! 016| 80 exe 'normal! ' . s:c . '|zs' . 16 . '|' 81 normal! 016| 82 exe 'normal! ' . s:c . '|zs' . 8 . '|' 83 normal! 08| 84 exe 'normal! ' . s:c . '|zs' . 8 . '|' 85 normal! 08| 86 exe 'normal! ' . s:c . '|zs' . 16 . '|' 87 normal! 016| 88 exe 'normal! ' . s:c . '|zs' . 16 . '|' 89 normal! 016| 90 exe 'normal! ' . s:c . '|zs' . 16 . '|' 91 normal! 016| 92 exe 'normal! ' . s:c . '|zs' . 16 . '|' 93 normal! 016| 94 [DATA] 95 96 call assert_equal(expected, li) 97 tabclose! 98 99 call delete('test_mks.out') 100 call delete(tmpfile) 101 let &wrap = wrap_save 102 set sessionoptions& splitbelow& fileencoding& 103endfunc 104 105" vim: shiftwidth=2 sts=2 expandtab 106