/
fixit.test.vim
55 lines (47 loc) · 1.72 KB
/
fixit.test.vim
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 youcompleteme#test#setup#OpenFile(
\ '/third_party/ycmd/ycmd/tests/java/testdata/simple_eclipse_project' .
\ '/src/com/test/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