Add some tests for InsertNamespace
This commit is contained in:
parent
62a815275f
commit
26141253a5
@ -1531,3 +1531,34 @@ def SelectFromList_Negative_test( vim_eval ):
|
|||||||
assert_that( calling( vimsupport.SelectFromList ).with_args( 'test',
|
assert_that( calling( vimsupport.SelectFromList ).with_args( 'test',
|
||||||
[ 'a', 'b' ] ),
|
[ 'a', 'b' ] ),
|
||||||
raises( RuntimeError, vimsupport.NO_SELECTION_MADE_MSG ) )
|
raises( RuntimeError, vimsupport.NO_SELECTION_MADE_MSG ) )
|
||||||
|
|
||||||
|
|
||||||
|
@patch( 'ycm.vimsupport.VariableExists', return_value = False )
|
||||||
|
@patch( 'ycm.vimsupport.SearchInCurrentBuffer', return_value = 0 )
|
||||||
|
@patch( 'vim.current' )
|
||||||
|
def InsertNamespace_insert_test( vim_current, *args ):
|
||||||
|
contents = [ 'var taco = Math' ]
|
||||||
|
vim_current.buffer = VimBuffer( '', contents = contents )
|
||||||
|
|
||||||
|
vimsupport.InsertNamespace( 'System' )
|
||||||
|
|
||||||
|
expected_buffer = [ 'using System;',
|
||||||
|
'var taco = Math' ]
|
||||||
|
AssertBuffersAreEqualAsBytes( expected_buffer, vim_current.buffer )
|
||||||
|
|
||||||
|
|
||||||
|
@patch( 'ycm.vimsupport.VariableExists', return_value = False )
|
||||||
|
@patch( 'ycm.vimsupport.SearchInCurrentBuffer', return_value = 1 )
|
||||||
|
@patch( 'vim.current' )
|
||||||
|
def InsertNamespace_append_test( vim_current, *args ):
|
||||||
|
contents = [ 'using System;', '', 'var taco;', 'var salad = new List']
|
||||||
|
vim_current.buffer = VimBuffer( '', contents = contents )
|
||||||
|
|
||||||
|
vimsupport.InsertNamespace( 'System.Collections' )
|
||||||
|
|
||||||
|
expected_buffer = [ 'using System;',
|
||||||
|
'using System.Collections;',
|
||||||
|
'',
|
||||||
|
'var taco;',
|
||||||
|
'var salad = new List' ]
|
||||||
|
AssertBuffersAreEqualAsBytes( expected_buffer, vim_current.buffer )
|
||||||
|
Loading…
Reference in New Issue
Block a user