File: file_goto.vader

package info (click to toggle)
vim-vimwiki 2024.01.24-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,692 kB
  • sloc: sh: 313; makefile: 2
file content (83 lines) | stat: -rw-r--r-- 2,793 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# VimwikiGoto
#
# Note: I dont know why <Tab> is inserting a Tab.
#   Well better than to insert a Chair, but it should trigger completion
#   So I used C-L


Execute (VimwikiGoto buzz_bozz && Assert):
  VimwikiIndex 2
  VimwikiGoto buzz_bozz
  AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')

Execute (VimwikiGoto buzz bozz && Assert):
  VimwikiIndex 4
  VimwikiGoto buzz bozz
  AssertEqual $HOME . '/testwiki space/buzz bozz.wiki', expand('%')

Do (VimwikiGoto <CR> buzz_bozz && Assert):
  :VimwikiIndex 2\<CR>
  :VimwikiGoto\<CR>
  buzz_bozz\<CR>
  :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>

Do (VimwikiGoto + Completion(cmdline) && Assert):
  :VimwikiIndex 2\<CR>
  :VimwikiGoto buzz_bo\<C-l>\<CR>
  :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>

Do (VimwikiGoto <CR> buzz_bo + Completion(input()) && Assert):
  :VimwikiIndex 2\<CR>
  :VimwikiGoto\<CR>
  buzz_bo\<C-l>\<CR>
  :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>

Do (,wn buzz_bo + Completion(input()) && Assert):
  ,wn
  buzz_bo\<C-l>\<CR>
  :AssertEqual $HOME . '/testmarkdown/buzz_bozz.md', expand('%')\<CR>

Execute (:VimwikiGoto + Completion (API)):
  VimwikiIndex 2
  AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
  let s_complete=string(vimwiki#base#get_globlinks_raw())
  Assert -1 != stridx(s_complete, 'buzz_bozz')

Execute (Create dir1/dir2/test_goto_file.md):
  call system("mkdir $HOME/testmarkdown/dir1")
  call system("mkdir $HOME/testmarkdown/dir1/dir2")
  edit $HOME/testmarkdown/dir1/dir2/test_goto_file.md
  call WriteMe()

Execute (:VimwikiGoto + Completion in directory):
  " Return to base
  VimwikiIndex 2
  AssertEqual $HOME . '/testmarkdown/index.md', expand('%')

  " Complete without argment
  let s_complete1=string(vimwiki#base#get_globlinks_raw())
  Assert -1 != stridx(s_complete1, 'test_goto_file')

  " Complete with file argument
  let s_complete2=string(vimwiki#base#get_globlinks_raw('test_goto_file'))
  Assert -1 != stridx(s_complete2, 'test_goto_file')

  " Complete with start of file argument
  let s_complete3=string(vimwiki#base#get_globlinks_raw('test_got'))
  Assert -1 != stridx(s_complete3, 'test_goto_file')

  " Complete with (nested) dir2 argument
  let s_complete4=string(vimwiki#base#get_globlinks_raw('dir2'))
  Assert -1 != stridx(s_complete4, 'test_goto_file')

  " Complete with bad argument
  let l_complete5=vimwiki#base#get_globlinks_raw('this_string_is_nowhere')
  let s_complete5=string(l_complete5)
  Assert -1 == stridx(s_complete5, 'test_goto_file')
  AssertEqual 0, len(l_complete5)

Execute (Clean):
  call DeleteFile("$HOME/testmarkdown/dir1/dir2/test_goto_file.md")
  call system("rm $HOME/testmarkdown/dir1")

# vim: sw=2 foldmethod=indent foldlevel=30 foldignore=