|
39 | 39 | StartJavaCompleterServerWithFile ) |
40 | 40 | from ycmd.tests.test_utils import ( BuildRequest, |
41 | 41 | CompleterProjectDirectoryMatcher, |
| 42 | + LocationMatcher, |
42 | 43 | MockProcessTerminationTimingOut, |
| 44 | + RangeMatcher, |
43 | 45 | TemporaryTestDir, |
| 46 | + WaitForDiagnosticsToBeReady, |
44 | 47 | WaitUntilCompleterServerReady ) |
45 | 48 | from ycmd import utils, handlers |
46 | 49 |
|
@@ -296,6 +299,45 @@ def test_ServerManagement_ProjectDetection_MavenParent_Submodule( self, app ): |
296 | 299 | CompleterProjectDirectoryMatcher( project ) ) |
297 | 300 |
|
298 | 301 |
|
| 302 | + @TidyJDTProjectFiles( PathToTestFile( 'gradle-init' ) ) |
| 303 | + @IsolatedYcmd() |
| 304 | + def test_ServerManagement_ProjectDetection_GradleMultipleGradleFiles( self, |
| 305 | + app ): |
| 306 | + testfile = PathToTestFile( 'gradle-init', |
| 307 | + 'app', |
| 308 | + 'src', |
| 309 | + 'main', |
| 310 | + 'java', |
| 311 | + 'org', |
| 312 | + 'example', |
| 313 | + 'app', |
| 314 | + 'App.java' ) |
| 315 | + project = PathToTestFile( 'gradle-init' ) |
| 316 | + |
| 317 | + StartJavaCompleterServerWithFile( app, testfile ) |
| 318 | + |
| 319 | + # Run the debug info to check that we have the correct project dir |
| 320 | + request_data = BuildRequest( filetype = 'java' ) |
| 321 | + assert_that( app.post_json( '/debug_info', request_data ).json, |
| 322 | + CompleterProjectDirectoryMatcher( project ) ) |
| 323 | + |
| 324 | + # Check that we successfully actually parse the project too |
| 325 | + contents = utils.ReadFile( testfile ) |
| 326 | + diags = WaitForDiagnosticsToBeReady( app, testfile, contents, 'java' ) |
| 327 | + assert_that( diags, has_item( |
| 328 | + has_entries( { |
| 329 | + 'kind': 'WARNING', |
| 330 | + 'text': 'The value of the local variable unused is not used ' |
| 331 | + '[536870973]', |
| 332 | + 'location': LocationMatcher( testfile, 16, 16 ), |
| 333 | + 'location_extent': RangeMatcher( testfile, ( 16, 16 ), ( 16, 22 ) ), |
| 334 | + 'ranges': contains_exactly( |
| 335 | + RangeMatcher( testfile, ( 16, 16 ), ( 16, 22 ) ) ), |
| 336 | + 'fixit_available': False |
| 337 | + } ), |
| 338 | + ) ) |
| 339 | + |
| 340 | + |
299 | 341 | def test_ServerManagement_ProjectDetection_NoParent( self ): |
300 | 342 | with TemporaryTestDir() as tmp_dir: |
301 | 343 | with isolated_app() as app: |
|
0 commit comments