view src/testdir/test_source_utf8.vim @ 10060:cf9e550f17f6 v7.4.2301

commit https://github.com/vim/vim/commit/641ad6c7ac7367f95fd927b8efa4bf74ddb9ccf3 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 1 18:32:11 2016 +0200 patch 7.4.2301 Problem: MS-Windows: some files remain after testing. Solution: Close the channel output file. Wait for the file handle to be closed before deleting the file.
author Christian Brabandt <cb@256bit.org>
date Thu, 01 Sep 2016 18:45:07 +0200
parents bff8a09016a5
children aa658b33f25a
line wrap: on
line source

" Test the :source! command
if !has('multi_byte')
  finish
endif

func Test_source_utf8()
  " check that sourcing a script with 0x80 as second byte works
  new
  call setline(1, [':%s/àx/--à1234--/g', ':%s/Àx/--À1234--/g'])
  write! Xscript
  bwipe!
  new
  call setline(1, [' àx ', ' Àx '])
  source! Xscript | echo
  call assert_equal(' --à1234-- ', getline(1))
  call assert_equal(' --À1234-- ', getline(2))
  bwipe!
  call delete('Xscript')
endfunc

func Test_source_latin()
  " check that sourcing a latin1 script with a 0xc0 byte works
  new
  call setline(1, ["call feedkeys('r')", "call feedkeys('\xc0', 'xt')"])
  write! Xscript
  bwipe!
  new
  call setline(1, ['xxx'])
  source Xscript
  call assert_equal("\u00c0xx", getline(1))
  bwipe!
  call delete('Xscript')
endfunc