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