Tests for checking that extra_conf_data sended to server from :DebugInfo and :YcmCompleter commands.
This commit is contained in:
parent
3db1413cd9
commit
592b85516b
@ -32,13 +32,19 @@ from mock import patch
|
|||||||
from ycm.tests import YouCompleteMeInstance
|
from ycm.tests import YouCompleteMeInstance
|
||||||
|
|
||||||
|
|
||||||
@YouCompleteMeInstance()
|
@YouCompleteMeInstance( { 'extra_conf_vim_data': [ 'tempname()' ] } )
|
||||||
def SendCommandRequest_test( ycm ):
|
def SendCommandRequest_test( ycm ):
|
||||||
current_buffer = VimBuffer( 'buffer' )
|
current_buffer = VimBuffer( 'buffer' )
|
||||||
with MockVimBuffers( [ current_buffer ], current_buffer ):
|
with MockVimBuffers( [ current_buffer ], current_buffer ):
|
||||||
|
with patch( 'ycm.youcompleteme.SendCommandRequest' ) as send_request:
|
||||||
|
ycm.SendCommandRequest( [ 'GoTo' ], 'python' )
|
||||||
|
send_request.assert_called_once_with(
|
||||||
|
[ 'GoTo' ], 'python', { 'extra_conf_data': {
|
||||||
|
'tempname()': '_TEMP_FILE_' } }
|
||||||
|
)
|
||||||
with patch( 'ycm.client.base_request.JsonFromFuture',
|
with patch( 'ycm.client.base_request.JsonFromFuture',
|
||||||
return_value = 'Some response' ):
|
return_value = 'Some response' ):
|
||||||
assert_that(
|
assert_that(
|
||||||
ycm.SendCommandRequest( 'GoTo', 'python' ),
|
ycm.SendCommandRequest( [ 'GoTo' ], 'python' ),
|
||||||
equal_to( 'Some response' )
|
equal_to( 'Some response' )
|
||||||
)
|
)
|
||||||
|
7
python/ycm/tests/testdata/.ycm_extra_conf.py
vendored
Normal file
7
python/ycm/tests/testdata/.ycm_extra_conf.py
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
def FlagsForFile( filename, **kwargs ):
|
||||||
|
temp_dir = kwargs[ 'client_data' ][ 'tempname()' ]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'flags': [ temp_dir ],
|
||||||
|
'do_cache': False
|
||||||
|
}
|
@ -140,9 +140,16 @@ def YouCompleteMe_NotifyUserIfServerCrashed_UnexpectedExitCode_test():
|
|||||||
} )
|
} )
|
||||||
|
|
||||||
|
|
||||||
@YouCompleteMeInstance()
|
@YouCompleteMeInstance( { 'extra_conf_vim_data': [ 'tempname()' ] } )
|
||||||
def YouCompleteMe_DebugInfo_ServerRunning_test( ycm ):
|
def YouCompleteMe_DebugInfo_ServerRunning_test( ycm ):
|
||||||
current_buffer = VimBuffer( 'current_buffer' )
|
dir_of_script = os.path.dirname( os.path.abspath( __file__ ) )
|
||||||
|
buf_name = os.path.join( dir_of_script, 'testdata', 'test.cpp' )
|
||||||
|
extra_conf = os.path.join( dir_of_script, 'testdata', '.ycm_extra_conf.py' )
|
||||||
|
|
||||||
|
from ycm.client.base_request import _LoadExtraConfFile
|
||||||
|
_LoadExtraConfFile( extra_conf )
|
||||||
|
|
||||||
|
current_buffer = VimBuffer( buf_name, filetype='cpp' )
|
||||||
with MockVimBuffers( [ current_buffer ], current_buffer ):
|
with MockVimBuffers( [ current_buffer ], current_buffer ):
|
||||||
assert_that(
|
assert_that(
|
||||||
ycm.DebugInfo(),
|
ycm.DebugInfo(),
|
||||||
@ -150,9 +157,14 @@ def YouCompleteMe_DebugInfo_ServerRunning_test( ycm ):
|
|||||||
'Client logfile: .+\n'
|
'Client logfile: .+\n'
|
||||||
'Server Python interpreter: .+\n'
|
'Server Python interpreter: .+\n'
|
||||||
'Server Python version: .+\n'
|
'Server Python version: .+\n'
|
||||||
'Server has Clang support compiled in: (True|False)\n'
|
'Server has Clang support compiled in: '
|
||||||
|
'(?P<CLANG>True)?(?(CLANG)|False)\n'
|
||||||
'Clang version: .+\n'
|
'Clang version: .+\n'
|
||||||
'No extra configuration file found\n'
|
'Extra configuration file found and loaded\n'
|
||||||
|
'Extra configuration path: .*/testdata/\\.ycm_extra_conf\\.py\n'
|
||||||
|
'(?(CLANG)C-family completer debug information:\n'
|
||||||
|
' Compilation database path: None\n'
|
||||||
|
' Flags: \\[\'_TEMP_FILE_\'.*\\]\n)'
|
||||||
'Server running at: .+\n'
|
'Server running at: .+\n'
|
||||||
'Server process ID: \d+\n'
|
'Server process ID: \d+\n'
|
||||||
'Server logfiles:\n'
|
'Server logfiles:\n'
|
||||||
|
Loading…
Reference in New Issue
Block a user