|
32 | 32 |
|
33 | 33 | from ycmd import handlers |
34 | 34 | from ycmd.tests.go import setUpModule, tearDownModule # noqa |
35 | | -from ycmd.tests.go import PathToTestFile, SharedYcmd |
| 35 | +from ycmd.tests.go import ( PathToTestFile, |
| 36 | + SharedYcmd, |
| 37 | + IsolatedYcmd, |
| 38 | + StartGoCompleterServerInDirectory ) |
36 | 39 | from ycmd.tests.test_utils import ( BuildRequest, |
37 | 40 | ChunkMatcher, |
38 | 41 | ErrorMatcher, |
@@ -391,10 +394,10 @@ def test_Subcommands_GoToType( self, app ): |
391 | 394 | def test_Subcommands_GoToImplementation( self, app ): |
392 | 395 | for test in [ |
393 | 396 | # Works |
394 | | - { 'req': ( 'thing.go', 3, 8 ), |
395 | | - 'res': ( 'thing.go', 7, 6 ) }, |
| 397 | + { 'req': ( 'thing.go', 5, 8 ), |
| 398 | + 'res': ( 'thing.go', 9, 6 ) }, |
396 | 399 | # Fails |
397 | | - { 'req': ( 'thing.go', 12, 7 ), |
| 400 | + { 'req': ( 'thing.go', 10, 1 ), |
398 | 401 | 'res': 'Cannot jump to location' } ]: |
399 | 402 | with self.subTest( test = test ): |
400 | 403 | RunGoToTest( app, 'GoToImplementation', test ) |
@@ -508,3 +511,20 @@ def test_Subcommands_GoToCallers( self, app ): |
508 | 511 | ]: |
509 | 512 | with self.subTest( test = test ): |
510 | 513 | RunGoToTest( app, 'GoToCallers', test ) |
| 514 | + |
| 515 | + |
| 516 | + @IsolatedYcmd() |
| 517 | + def test_Subcommands_GoTo_WorksAfterSwitchingProjects( self, app ): |
| 518 | + project_dir = PathToTestFile( module_dir = 'go_module_2' ) |
| 519 | + StartGoCompleterServerInDirectory( app, project_dir ) |
| 520 | + go_module_2_main = PathToTestFile( 'main.go', module_dir = 'go_module_2' ) |
| 521 | + thing_go = PathToTestFile( 'thing.go' ) |
| 522 | + td_test_go = PathToTestFile( 'td', 'test.go' ) |
| 523 | + for test in [ |
| 524 | + { 'req': ( go_module_2_main, 6, 3 ), |
| 525 | + 'res': ( go_module_2_main, 3, 6 ) }, |
| 526 | + { 'req': ( thing_go, 12, 8 ), |
| 527 | + 'res': ( td_test_go, 9, 6 ) } |
| 528 | + ]: |
| 529 | + with self.subTest( test = test ): |
| 530 | + RunGoToTest( app, 'GoTo', test ) |
0 commit comments