HEX
Server: nginx/1.24.0
System: Linux prod-btpayments-io 6.14.0-1018-aws #18~24.04.1-Ubuntu SMP Mon Nov 24 19:46:27 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.3.19
Disabled: NONE
Upload Files
File: //home/btminers/.vim/bundle/vim-textobj-user/t/script-local.vim
call vspec#hint({'sid': 'textobj#user#_sid()'})

let s:counter = [0]
function! s:increment()
  let s:counter[0] += 1
  return 0
endfunction

call textobj#user#plugin('dummy', {
\   '-': {
\     '*sfile*': expand('<sfile>:p'),
\     '*select-function*': 's:increment',
\     'select': ['ad', 'id'],
\   },
\ })

describe '*sfile*'
  it 'can call a script-local function'
    let c = s:counter

    Expect c[0] == 0

    execute 'normal' "vid\<Esc>"
    Expect c[0] == 1

    execute 'normal' "vad\<Esc>"
    Expect c[0] == 2
  end
end

describe 's:normalize_path'
  it 'normalizes a backslashed path into a forwardslashed path'
    Expect Call(
    \   's:normalize_path',
    \   '/c/Users/who\vimfiles\plugin\textobj\foo.vim'
    \ ) ==# '/c/Users/who/vimfiles/plugin/textobj/foo.vim'
  end
end