123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- function! SetUp()
- let g:ycm_use_clangd = 1
- 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'
- let g:ycm_always_populate_location_list = 1
- call youcompleteme#test#setup#SetUp()
- endfunction
- function! TearDown()
- call youcompleteme#test#setup#CleanUp()
- endfunction
- function! Test_Changing_Filetype_Refreshes_Diagnostics()
- call youcompleteme#test#setup#OpenFile(
- \ '/test/testdata/diagnostics/foo.xml',
- \ { 'native_ft': 0 } )
- call assert_equal( 'xml', &ft )
- call assert_true( pyxeval( 'ycm_state._buffers[' . bufnr( '%' ) . ']._async_diags' ) )
- call assert_equal( [], sign_getplaced() )
- setf typescript
- call assert_equal( 'typescript', &ft )
- call assert_false( pyxeval( 'ycm_state._buffers[' . bufnr( '%' ) . ']._async_diags' ) )
- " Diagnostics are async, so wait for the assert to return 0 for a while.
- call WaitForAssert( {-> assert_equal( 1, len( sign_getplaced() ) ) } )
- call assert_equal( 1, len( sign_getplaced()[ 0 ][ 'signs' ] ) )
- call assert_equal( 'YcmError', sign_getplaced()[ 0 ][ 'signs' ][ 0 ][ 'name' ] )
- call assert_false( empty( getloclist( 0 ) ) )
- %bwipeout!
- endfunction
- function! Test_MessagePoll_After_LocationList()
- call youcompleteme#test#setup#OpenFile( '/test/testdata/diagnostics/foo.cpp', {} )
- setf cpp
- call assert_equal( 'cpp', &ft )
- call WaitForAssert( {-> assert_equal( 1, len( sign_getplaced() ) ) } )
- call setline( 1, '' )
- doautocmd TextChanged
- call WaitForAssert( {-> assert_true( empty( sign_getplaced() ) ) }, 10000 )
- call assert_true( empty( getloclist( 0 ) ) )
- %bwipeout!
- endfunction
|