File: script-local.vim

package info (click to toggle)
vim-textobj-user 0.7.6-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 208 kB
  • sloc: makefile: 2
file content (38 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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