Skip to content

Commit b63e889

Browse files
committed
FixUp: tests broken by overzealous checking in java tests; we can probably relax a lot of these now
1 parent 18808ea commit b63e889

File tree

1 file changed

+59
-5
lines changed

1 file changed

+59
-5
lines changed

ycmd/tests/java/subcommands_test.py

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
instance_of,
2828
is_not,
2929
matches_regexp )
30-
from pprint import pformat
3130
import itertools
3231
import requests
3332
import json
@@ -108,15 +107,16 @@ def RunTest( app, test, contents = None ):
108107
expect_errors = True
109108
)
110109

111-
print( f'completer response: { pformat( response.json ) }' )
112-
113110
assert_that( response.status_code,
114111
equal_to( test[ 'expect' ][ 'response' ] ) )
115112

116113
assert_that( response.json, test[ 'expect' ][ 'data' ] )
117114
break
118115
except AssertionError:
119116
if time.time() > expiry:
117+
print( 'completer response: '
118+
f'{ json.dumps( response.json, indent=2 ) }' )
119+
120120
raise
121121

122122
time.sleep( 0.25 )
@@ -1089,6 +1089,10 @@ def test_Subcommands_FixIt_SingleDiag_MultipleOption_Insertion( self, app ):
10891089
LocationMatcher( filepath, 25, 5 ) ),
10901090
),
10911091
} ),
1092+
has_entries( {
1093+
'kind': 'quickassist',
1094+
'text': "Add Javadoc for 'Wimble'"
1095+
} ),
10921096
)
10931097
} )
10941098

@@ -1147,6 +1151,9 @@ def test_Subcommands_FixIt_SingleDiag_SingleOption_Modify( self, app ):
11471151
LocationMatcher( filepath, 25, 5 ) ),
11481152
),
11491153
} ),
1154+
has_entries( {
1155+
'text': "Add Javadoc for 'getWidget'"
1156+
} ),
11501157
)
11511158
} )
11521159

@@ -1179,21 +1186,42 @@ def test_Subcommands_FixIt_SingleDiag_MultiOption_Delete( self, app ):
11791186
# FixIt (and nonetheless, the previous tests ensure that we correctly
11801187
# populate the chunks list; the contents all come from jdt.ls)
11811188
has_entries( {
1182-
'text': "Create getter and setter for 'testString'",
1189+
'text': "Organize imports",
11831190
'chunks': instance_of( list )
11841191
} ),
11851192
has_entries( {
1186-
'text': "Organize imports",
1193+
'text': "Generate Getter and Setter for 'testString'",
11871194
'chunks': instance_of( list )
11881195
} ),
11891196
has_entries( {
11901197
'text': "Generate Getters and Setters",
11911198
'chunks': instance_of( list )
11921199
} ),
1200+
has_entries( {
1201+
'text': "Generate Getters",
1202+
'chunks': instance_of( list )
1203+
} ),
1204+
has_entries( {
1205+
'text': "Generate Setters",
1206+
'chunks': instance_of( list )
1207+
} ),
1208+
has_entries( {
1209+
'text': "Generate Getter for 'testString'",
1210+
'chunks': instance_of( list )
1211+
} ),
1212+
has_entries( {
1213+
'text': "Generate Setter for 'testString'",
1214+
'chunks': instance_of( list )
1215+
} ),
11931216
has_entries( {
11941217
'text': 'Change modifiers to final where possible',
11951218
'chunks': instance_of( list )
11961219
} ),
1220+
has_entries( {
1221+
'kind': 'quickassist',
1222+
'text': "Add Javadoc for 'testString'",
1223+
'chunks': instance_of( list )
1224+
} ),
11971225
)
11981226
} )
11991227

@@ -1272,6 +1300,10 @@ def test_Subcommands_FixIt_MultipleDiags( self, app ):
12721300
'text': 'Change modifiers to final where possible',
12731301
'chunks': instance_of( list ),
12741302
} ),
1303+
has_entries( {
1304+
'text': "Add Javadoc for 'getWidget'",
1305+
'chunks': instance_of( list ),
1306+
} ),
12751307
]
12761308

12771309
FIXITS = {
@@ -1396,6 +1428,10 @@ def test_Subcommands_FixIt_Range( self, app ):
13961428
'text': 'Change modifiers to final where possible',
13971429
'chunks': instance_of( list ),
13981430
} ),
1431+
has_entries( {
1432+
'text': "Add Javadoc for 'launch'",
1433+
'chunks': instance_of( list ),
1434+
} ),
13991435
)
14001436
} )
14011437
}
@@ -1460,10 +1496,19 @@ def test_Subcommands_FixIt_Unicode( self, app ):
14601496
'text': 'Change modifiers to final where possible',
14611497
'chunks': instance_of( list ),
14621498
} ),
1499+
has_entries( {
1500+
'text': "Generate Getters",
1501+
} ),
1502+
has_entries( {
1503+
'text': "Generate Setters",
1504+
} ),
14631505
has_entries( {
14641506
'text': "Generate Getters and Setters",
14651507
'chunks': instance_of( list ),
14661508
} ),
1509+
has_entries( {
1510+
'text': "Add Javadoc for 'DoWhatever'"
1511+
} ),
14671512
)
14681513
} )
14691514

@@ -1525,6 +1570,9 @@ def test_Subcommands_FixIt_InvalidURI( self, app ):
15251570
LocationMatcher( '', 32, 4 ) ),
15261571
),
15271572
} ),
1573+
has_entries( {
1574+
'text': "Add Javadoc for 'getWidget'"
1575+
} ),
15281576
)
15291577
} )
15301578

@@ -1638,6 +1686,9 @@ def test_Subcommands_Format_WholeFile_Spaces( self, app ):
16381686
ChunkMatcher( '\n ',
16391687
LocationMatcher( TEST_JAVA, 24, 27 ),
16401688
LocationMatcher( TEST_JAVA, 25, 3 ) ),
1689+
ChunkMatcher( '\n',
1690+
LocationMatcher( TEST_JAVA, 26, 2 ),
1691+
LocationMatcher( TEST_JAVA, 28, 1 ) ),
16411692
)
16421693
} ) )
16431694
} )
@@ -1724,6 +1775,9 @@ def test_Subcommands_Format_WholeFile_Tabs( self, app ):
17241775
ChunkMatcher( '\n\t',
17251776
LocationMatcher( TEST_JAVA, 24, 27 ),
17261777
LocationMatcher( TEST_JAVA, 25, 3 ) ),
1778+
ChunkMatcher( '\n',
1779+
LocationMatcher( TEST_JAVA, 26, 2 ),
1780+
LocationMatcher( TEST_JAVA, 28, 1 ) ),
17271781
)
17281782
} ) )
17291783
} )

0 commit comments

Comments
 (0)