Clean code in vimsupport tests
This commit is contained in:
parent
33316d8bf8
commit
2c72a3c598
@ -20,6 +20,7 @@
|
||||
from ycm import vimsupport
|
||||
from nose.tools import eq_
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Repl_1_test():
|
||||
# Replace with longer range
|
||||
# 12345678901234567
|
||||
@ -75,6 +76,7 @@ def ReplaceChunk_SingleLine_Repl_1_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, 10 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Repl_2_test():
|
||||
# Replace with shorter range
|
||||
# 12345678901234567
|
||||
@ -91,6 +93,7 @@ def ReplaceChunk_SingleLine_Repl_2_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, -2 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Repl_3_test():
|
||||
# Replace with equal range
|
||||
# 12345678901234567
|
||||
@ -107,6 +110,7 @@ def ReplaceChunk_SingleLine_Repl_3_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, 0 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Add_1_test():
|
||||
# Insert at start
|
||||
result_buffer = [ "is a string" ]
|
||||
@ -122,6 +126,7 @@ def ReplaceChunk_SingleLine_Add_1_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, 5 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Add_2_test():
|
||||
# Insert at end
|
||||
result_buffer = [ "This is a " ]
|
||||
@ -137,6 +142,7 @@ def ReplaceChunk_SingleLine_Add_2_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, 6 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Add_3_test():
|
||||
# Insert in the middle
|
||||
result_buffer = [ "This is a string" ]
|
||||
@ -152,6 +158,7 @@ def ReplaceChunk_SingleLine_Add_3_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, 4 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Del_1_test():
|
||||
# Delete from start
|
||||
result_buffer = [ "This is a string" ]
|
||||
@ -167,6 +174,7 @@ def ReplaceChunk_SingleLine_Del_1_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, -5 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Del_2_test():
|
||||
# Delete from end
|
||||
result_buffer = [ "This is a string" ]
|
||||
@ -182,6 +190,7 @@ def ReplaceChunk_SingleLine_Del_2_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, -8 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleLine_Del_3_test():
|
||||
# Delete from middle
|
||||
result_buffer = [ "This is not a string" ]
|
||||
@ -197,6 +206,7 @@ def ReplaceChunk_SingleLine_Del_3_test():
|
||||
eq_( line_offset, 0 )
|
||||
eq_( char_offset, -4 )
|
||||
|
||||
|
||||
def ReplaceChunk_RemoveSingleLine_test():
|
||||
result_buffer = [ "aAa", "aBa", "aCa" ]
|
||||
start, end = _BuildLocations( 2, 1, 3, 1 )
|
||||
@ -250,7 +260,7 @@ def ReplaceChunk_SingleToMultipleLines2_test():
|
||||
0,
|
||||
0,
|
||||
result_buffer )
|
||||
expected_buffer = [ "aAa", "aEb" ,"bFb", "GBa", "aCa" ]
|
||||
expected_buffer = [ "aAa", "aEb", "bFb", "GBa", "aCa" ]
|
||||
eq_( expected_buffer, result_buffer )
|
||||
eq_( line_offset, 2 )
|
||||
eq_( char_offset, 0 )
|
||||
@ -265,11 +275,12 @@ def ReplaceChunk_SingleToMultipleLines3_test():
|
||||
0,
|
||||
0,
|
||||
result_buffer )
|
||||
expected_buffer = [ "aAa", "aEb" ,"bFb", "bGbBa", "aCa" ]
|
||||
expected_buffer = [ "aAa", "aEb", "bFb", "bGbBa", "aCa" ]
|
||||
eq_( expected_buffer, result_buffer )
|
||||
eq_( line_offset, 2 )
|
||||
eq_( char_offset, 2 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleToMultipleLinesReplace_test():
|
||||
result_buffer = [ "aAa", "aBa", "aCa" ]
|
||||
start, end = _BuildLocations( 1, 2, 1, 4 )
|
||||
@ -284,6 +295,7 @@ def ReplaceChunk_SingleToMultipleLinesReplace_test():
|
||||
eq_( line_offset, 2 )
|
||||
eq_( char_offset, 0 )
|
||||
|
||||
|
||||
def ReplaceChunk_SingleToMultipleLinesReplace_2_test():
|
||||
result_buffer = [ "aAa",
|
||||
"aBa",
|
||||
|
Loading…
x
Reference in New Issue
Block a user