install.fairie/dotfiles/.vim/plugged/vim-go/autoload/go/lsp/lsp_test.vim
Git E2E Dev Test Username 630be49632 git subrepo clone (merge) https://github.com/fatih/vim-go.git ./dotfiles/.vim/plugged/vim-go
subrepo:
  subdir:   "dotfiles/.vim/plugged/vim-go"
  merged:   "22b2273cf"
upstream:
  origin:   "https://github.com/fatih/vim-go.git"
  branch:   "master"
  commit:   "22b2273cf"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:40 -04:00

32 lines
819 B
VimL

" don't spam the user when Vim is started in Vi compatibility mode
let s:cpo_save = &cpo
set cpo&vim
scriptencoding utf-8
function! Test_PositionOf_Simple()
let l:actual = go#lsp#lsp#PositionOf("just ascii", 3)
call assert_equal(4, l:actual)
endfunc
function! Test_PositionOf_MultiByte()
" ⌘ is U+2318, which encodes to three bytes in utf-8 and 1 code unit in
" utf-16.
let l:actual = go#lsp#lsp#PositionOf("⌘⌘ foo", 3)
call assert_equal(8, l:actual)
endfunc
function! Test_PositionOf_MultipleCodeUnit()
" 𐐀 is U+10400, which encodes to 4 bytes in utf-8 and 2 code units in
" utf-16.
let l:actual = go#lsp#lsp#PositionOf("𐐀 bar", 3)
call assert_equal(6, l:actual)
endfunction
" restore Vi compatibility settings
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: sw=2 ts=2 et