File: fixit.test.vim

package info (click to toggle)
vim-youcompleteme 0%2B20230109%2Bgit7620d87%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,404 kB
  • sloc: python: 10,569; sh: 203; cpp: 121; makefile: 24; f90: 5; xml: 1
file content (55 lines) | stat: -rw-r--r-- 1,702 bytes parent folder | download | duplicates (3)
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
function! SetUp()
  let g:ycm_confirm_extra_conf = 0
  let g:ycm_auto_trigger = 1
  let g:ycm_keep_logfiles = 1
  let g:ycm_log_level = 'DEBUG'

  call youcompleteme#test#setup#SetUp()
endfunction

function! TearDown()
  call youcompleteme#test#setup#CleanUp()
endfunction

function! Test_Ranged_Fixit_Works()
  call SkipJava()
  call youcompleteme#test#setup#OpenFile(
        \ '/debian/tests/data/TestLauncher.java', { 'delay': 15 } )

  call setpos( '.', [ 0, 34, 50 ] )
  redraw
  call assert_equal( '        System.out.println( "Did something useful: ' .
                     \ '" + w.getWidgetInfo() );', getline( '.' ) )
  call feedkeys( "vib\<esc>", 'xt' )

  function! SelectEntry( id ) closure
    redraw
    call test_feedinput( "4\<CR>" )
  endfunction

  call timer_start( 5000, funcref( 'SelectEntry' ) )
  '<,'>YcmCompleter FixIt
  redraw

  call assert_match( '        String \(x\|string\) = "Did something useful: "' .
                     \ ' + w.getWidgetInfo();', getline( 34 ) )
  call assert_match( '        System.out.println( \(x\|string\) );', getline( 35 ) )
  delfunction SelectEntry
endfunction

function! Test_Unresolved_Fixit_Works()
  call youcompleteme#test#setup#OpenFile( '/test/testdata/cpp/fixit.cpp', {} )
  call setpos( '.', [ 0, 3, 15 ] )
  call assert_equal( '  printf("%s",1);', getline( '.' ) )
  function! SelectEntry( id ) closure
    redraw
    call test_feedinput( "2\<CR>" )
  endfunction
  call timer_start( 2000, funcref( 'SelectEntry' ) )
  YcmCompleter FixIt
  redraw
  call assert_equal( '  auto placeholder = 1;', getline( 3 ) )
  call assert_equal( '  printf("%s", placeholder);', getline( 4 ) )
  %bwipeout!
  delfunction SelectEntry
endfunction