def Subcommands_RefactorRename_MultipleFiles_test( app ): file1 = PathToTestFile( 'file1.js' ) file2 = PathToTestFile( 'file2.js' ) file3 = PathToTestFile( 'file3.js' ) RunTest( app, { 'description': 'RefactorRename works across files', 'request': { 'command': 'RefactorRename', 'arguments': [ 'a-quite-long-string' ], 'filepath': file1, 'line_num': 3, 'column_num': 14, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'fixits': contains_exactly( has_entries( { 'chunks': contains_exactly( ChunkMatcher( 'a-quite-long-string', LocationMatcher( file1, 1, 5 ), LocationMatcher( file1, 1, 11 ) ), ChunkMatcher( 'a-quite-long-string', LocationMatcher( file1, 3, 14 ), LocationMatcher( file1, 3, 20 ) ), ChunkMatcher( 'a-quite-long-string', LocationMatcher( file2, 2, 14 ), LocationMatcher( file2, 2, 20 ) ), ChunkMatcher( 'a-quite-long-string', LocationMatcher( file3, 3, 12 ), LocationMatcher( file3, 3, 18 ) ) ), 'location': LocationMatcher( file1, 3, 14 ) } ) ) } ) } } )
def Subcommands_GoToType_test(app): RunTest( app, { 'description': 'GoToType works', 'request': { 'command': 'GoToType', 'line_num': 11, 'column_num': 6, 'filepath': PathToTestFile('test.js'), }, 'expect': { 'response': requests.codes.ok, 'data': LocationMatcher(PathToTestFile('test.js'), 1, 7) } })
def Subcommands_GoTo(app, test, command): if isinstance(test['response'], tuple): if not isinstance(test['response'][0], StringMatchesPattern): expect = { 'response': requests.codes.ok, 'data': LocationMatcher(PathToTestFile('goto', test['response'][0]), test['response'][1], test['response'][2]) } else: expect = { 'response': requests.codes.ok, 'data': LocationMatcher(test['response'][0], test['response'][1], test['response'][2]) } else: expect = { 'response': requests.codes.internal_server_error, 'data': ErrorMatcher(RuntimeError, test['response']) } RunTest( app, { 'description': command + ' jumps to the right location', 'request': { 'command': command, 'filetype': 'python', 'filepath': PathToTestFile('goto', test['request'][0]), 'line_num': test['request'][1], 'column_num': test['request'][2] }, 'expect': expect, })
def Subcommands_FixIt_ApplySuggestion_test(app): # Similarly to textDocument/formatting, if a file has errors # RLS won't respond with `rls.applySuggestions` command. project_dir = PathToTestFile('formatting') StartRustCompleterServerInDirectory(app, project_dir) filepath = os.path.join(project_dir, 'src', 'main.rs') RunTest( app, { 'description': 'Simple FixIt test', 'request': { 'command': 'FixIt', 'line_num': 8, 'column_num': 13, 'filepath': filepath }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'fixits': contains_exactly( has_entries({ 'chunks': contains_exactly( ChunkMatcher('_x', LocationMatcher(filepath, 8, 13), LocationMatcher(filepath, 8, 14))) })) }) }, 'run_resolve_fixit_test': True })
def Subcommands_GoTo(app, goto_command): RunTest( app, { 'description': goto_command + ' works within file', 'request': { 'command': goto_command, 'line_num': 31, 'column_num': 13, 'filepath': PathToTestFile('test.js'), }, 'expect': { 'response': requests.codes.ok, 'data': LocationMatcher(PathToTestFile('test.js'), 27, 3) } })
def Subcommands_GoTo_Unicode_test( app ): filepath = PathToTestFile( 'testy', 'Unicode.cs' ) with WrapOmniSharpServer( app, filepath ): contents = ReadFile( filepath ) goto_data = BuildRequest( completer_target = 'filetype_default', command_arguments = [ 'GoTo' ], line_num = 45, column_num = 43, contents = contents, filetype = 'cs', filepath = filepath ) response = app.post_json( '/run_completer_command', goto_data ).json assert_that( response, LocationMatcher( filepath, 30, 54 ) )
def Subcommands_GoTo_Unicode(app, goto_command): RunTest( app, { 'description': goto_command + ' works with Unicode characters', 'request': { 'command': goto_command, 'line_num': 28, 'column_num': 19, 'filepath': PathToTestFile('unicode.ts'), }, 'expect': { 'response': requests.codes.ok, 'data': LocationMatcher(PathToTestFile('unicode.ts'), 15, 3) } })
def Subcommands_RefactorRename_test(app): filepath = PathToTestFile('unicode', 'unicode.go') RunTest( app, { 'description': 'RefactorRename on a function renames all its occurences', 'request': { 'command': 'RefactorRename', 'arguments': ['xxx'], 'line_num': 10, 'column_num': 17, 'filepath': filepath }, 'expect': { 'response': requests.codes.ok, 'data': has_entries({ 'fixits': contains_exactly( has_entries({ 'text': '', 'chunks': contains_exactly( ChunkMatcher('xxx', LocationMatcher(filepath, 3, 6), LocationMatcher(filepath, 3, 10)), ChunkMatcher( 'xxx', LocationMatcher(filepath, 10, 16), LocationMatcher(filepath, 10, 20)), ) })) }) } })
def Diagnostics_MaximumDiagnosticsNumberExceeded_test( app ): filepath = PathToTestFile( 'test.ts' ) contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, filetype = 'typescript', contents = contents, event_name = 'BufferVisit' ) app.post_json( '/event_notification', event_data ) event_data = BuildRequest( filepath = filepath, filetype = 'typescript', contents = contents, event_name = 'FileReadyToParse' ) assert_that( app.post_json( '/event_notification', event_data ).json, contains_inanyorder( has_entries( { 'kind': 'ERROR', 'text': "Property 'm' does not exist on type 'Foo'.", 'location': LocationMatcher( filepath, 17, 5 ), 'location_extent': RangeMatcher( filepath, ( 17, 5 ), ( 17, 6 ) ), 'ranges': contains( RangeMatcher( filepath, ( 17, 5 ), ( 17, 6 ) ) ), 'fixit_available': True } ), has_entries( { 'kind': 'ERROR', 'text': 'Maximum number of diagnostics exceeded.', 'location': LocationMatcher( filepath, 1, 1 ), 'location_extent': RangeMatcher( filepath, ( 1, 1 ), ( 1, 1 ) ), 'ranges': contains( RangeMatcher( filepath, ( 1, 1 ), ( 1, 1 ) ) ), 'fixit_available': False } ), ) )
def Subcommands_GoToReferences_Basic_test(app): filepath = PathToTestFile('testy', 'GotoTestCase.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) goto_data = BuildRequest(completer_target='filetype_default', command_arguments=['GoToReferences'], line_num=21, column_num=29, contents=contents, filetype='cs', filepath=filepath) response = app.post_json('/run_completer_command', goto_data).json assert_that(response, LocationMatcher(filepath, 21, 15))
def Subcommands_FixIt_Basic_test( app ): filepath = PathToTestFile( 'common', 'src', 'main.rs' ) RunTest( app, { 'description': 'Simple FixIt test', 'request': { 'command': 'FixIt', 'line_num': 17, 'column_num': 13, 'filepath': filepath }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'fixits': contains_exactly( has_entries( { 'chunks': contains_exactly( ChunkMatcher( 'pub(crate) ', LocationMatcher( filepath, 17, 1 ), LocationMatcher( filepath, 17, 1 ) ) ) } ) ) } ) }, } )
def Subcommands_Format_Range_Tabs_test( app ): filepath = PathToTestFile( 'test.js' ) RunTest( app, { 'description': 'Formatting is applied on some part of the file ' 'with tabs instead of spaces', 'request': { 'command': 'Format', 'filepath': filepath, 'range': { 'start': { 'line_num': 5, 'column_num': 3, }, 'end': { 'line_num': 8, 'column_num': 6 } }, 'options': { 'tab_size': 4, 'insert_spaces': False } }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'fixits': contains( has_entries( { 'chunks': contains( ChunkMatcher( '\t', LocationMatcher( filepath, 5, 1 ), LocationMatcher( filepath, 5, 3 ) ), ChunkMatcher( '\t\t', LocationMatcher( filepath, 6, 1 ), LocationMatcher( filepath, 6, 5 ) ), ChunkMatcher( '\t\t', LocationMatcher( filepath, 7, 1 ), LocationMatcher( filepath, 7, 5 ) ), ChunkMatcher( '\t', LocationMatcher( filepath, 8, 1 ), LocationMatcher( filepath, 8, 3 ) ), ) } ) ) } ) } } )
def Subcommands_GoToImplementationElseDeclaration_NoImplementation_test(app): filepath = PathToTestFile('testy', 'GotoTestCase.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) goto_data = BuildRequest( completer_target='filetype_default', command_arguments=['GoToImplementationElseDeclaration'], line_num=18, column_num=13, contents=contents, filetype='cs', filepath=filepath) response = app.post_json('/run_completer_command', goto_data).json assert_that(response, LocationMatcher(filepath, 36, 8))
def GetCompletions_ForceAtTopLevel_WithImport_test( app ): filepath = ProjectPath( 'TestWidgetImpl.java' ) RunTest( app, { 'description': 'Top level completions have import FixIts', 'request': { 'filetype' : 'java', 'filepath' : filepath, 'line_num' : 34, 'column_num': 15, 'force_semantic': True, }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'completions': has_item( CompletionEntryMatcher( 'InputStreamReader', None, { 'kind': 'Class', 'menu_text': 'InputStreamReader - java.io', 'extra_data': has_entries( { 'fixits': contains( has_entries( { 'chunks': contains( ChunkMatcher( '\n\n', LocationMatcher( filepath, 1, 18 ), LocationMatcher( filepath, 1, 18 ) ), ChunkMatcher( 'import java.io.InputStreamReader;', LocationMatcher( filepath, 1, 18 ), LocationMatcher( filepath, 1, 18 ) ), ChunkMatcher( '\n\n', LocationMatcher( filepath, 1, 18 ), LocationMatcher( filepath, 1, 18 ) ), ChunkMatcher( '', LocationMatcher( filepath, 1, 18 ), LocationMatcher( filepath, 3, 1 ) ), ), } ) ), } ), } ), ), 'completion_start_column': 12, 'errors': empty(), } ) }, } )
def Subcommands_RefactorRename_SimpleUnicode_test( app ): RunTest( app, { 'description': 'RefactorRename works with Unicode characters', 'request': { 'command': 'RefactorRename', 'arguments': [ 'ø' ], 'line_num': 14, 'column_num': 3, 'filepath': PathToTestFile( 'unicode.ts' ), }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'fixits': contains_exactly( has_entries( { 'chunks': contains_inanyorder( ChunkMatcher( 'ø', LocationMatcher( PathToTestFile( 'unicode.ts' ), 14, 3 ), LocationMatcher( PathToTestFile( 'unicode.ts' ), 14, 5 ) ), ChunkMatcher( 'ø', LocationMatcher( PathToTestFile( 'unicode.ts' ), 20, 27 ), LocationMatcher( PathToTestFile( 'unicode.ts' ), 20, 29 ) ), ChunkMatcher( 'ø', LocationMatcher( PathToTestFile( 'unicode.ts' ), 23, 5 ), LocationMatcher( PathToTestFile( 'unicode.ts' ), 23, 7 ) ), ChunkMatcher( 'ø', LocationMatcher( PathToTestFile( 'unicode.ts' ), 27, 17 ), LocationMatcher( PathToTestFile( 'unicode.ts' ), 27, 19 ) ), ), 'location': LocationMatcher( PathToTestFile( 'unicode.ts' ), 14, 3 ) } ) ) } ) } } )
def Subcommands_Format_WholeFile_test( app ): # RLS can't execute textDocument/formatting if any file # under the project root has errors, so we need to use # a different project just for formatting. # For further details check https://github.com/go-lang/rls/issues/1397 project_dir = PathToTestFile() StartGoCompleterServerInDirectory( app, project_dir ) filepath = os.path.join( project_dir, 'goto.go' ) RunTest( app, { 'description': 'Formatting is applied on the whole file', 'request': { 'command': 'Format', 'filepath': filepath, 'options': { 'tab_size': 2, 'insert_spaces': True } }, 'expect': { 'response': requests.codes.ok, 'data': has_entries( { 'fixits': contains_exactly( has_entries( { 'chunks': contains_exactly( ChunkMatcher( '', LocationMatcher( filepath, 8, 1 ), LocationMatcher( filepath, 8, 5 ) ), ChunkMatcher( '\t', LocationMatcher( filepath, 8, 5 ), LocationMatcher( filepath, 8, 5 ) ), ChunkMatcher( '', LocationMatcher( filepath, 12, 1 ), LocationMatcher( filepath, 12, 5 ) ), ChunkMatcher( '\t', LocationMatcher( filepath, 12, 5 ), LocationMatcher( filepath, 12, 5 ) ), ) } ) ) } ) } } )
def Subcommands_FixIt_Range_test(app): fixit_test = PathToTestFile('testy', 'FixItTestCase.cs') with WrapOmniSharpServer(app, fixit_test): contents = ReadFile(fixit_test) request = BuildRequest(completer_target='filetype_default', command_arguments=['FixIt'], line_num=4, column_num=23, contents=contents, filetype='cs', filepath=fixit_test) request.update({ 'range': { 'start': { 'line_num': 4, 'column_num': 23 }, 'end': { 'line_num': 4, 'column_num': 27 } } }) response = app.post_json('/run_completer_command', request).json assert_that( response, has_entries({ 'fixits': contains( has_entries({ 'location': LocationMatcher(fixit_test, 4, 23), 'chunks': contains( has_entries({ 'replacement_text': '\n {\n NewMethod();\n }\n\n' ' private static void NewMethod()\n {\r\n', 'range': RangeMatcher(fixit_test, (3, 31), (4, 1)) })) })) }))
def Subcommands_FixIt_Unicode_test(): filepath = PathToTestFile( 'simple_eclipse_project', 'src', 'com', 'youcompleteme', 'Test.java' ) fixits = has_entries ( { 'fixits': contains_inanyorder( has_entries( { 'text': "Remove argument to match 'doUnicødeTes()'", 'chunks': contains( ChunkMatcher( '', LocationMatcher( filepath, 13, 24 ), LocationMatcher( filepath, 13, 29 ) ), ), } ), has_entries( { 'text': "Change method 'doUnicødeTes()': Add parameter 'String'", 'chunks': contains( ChunkMatcher( 'String test2', LocationMatcher( filepath, 6, 31 ), LocationMatcher( filepath, 6, 31 ) ), ), } ), has_entries( { 'text': "Create method 'doUnicødeTes(String)'", 'chunks': contains( ChunkMatcher( 'private void doUnicødeTes(String test2) {\n}', LocationMatcher( filepath, 20, 3 ), LocationMatcher( filepath, 20, 3 ) ), ChunkMatcher( '\n\n\n', LocationMatcher( filepath, 20, 3 ), LocationMatcher( filepath, 20, 3 ) ), ), } ), ) } ) yield ( RunFixItTest, 'FixIts and diagnostics work with unicode strings', filepath, 13, 1, fixits )
def Subcommands_FixIt_Range_test(app): fixit_test = PathToTestFile('testy', 'FixItTestCase.cs') with WrapOmniSharpServer(app, fixit_test, wait_for_diags=False): contents = ReadFile(fixit_test) request = BuildRequest(completer_target='filetype_default', command_arguments=['FixIt'], line_num=4, column_num=17, contents=contents, filetype='cs', filepath=fixit_test) request.update({ 'range': { 'start': { 'line_num': 4, 'column_num': 17 }, 'end': { 'line_num': 4, 'column_num': 19 } } }) response = app.post_json('/run_completer_command', request).json assert_that( response, has_entries({ 'fixits': contains_exactly( has_entries({ 'location': LocationMatcher(fixit_test, 4, 17), 'chunks': contains_exactly( has_entries({ 'replacement_text': 'var', 'range': RangeMatcher(fixit_test, (4, 13), (4, 16)) })) })) }))
def Subcommands_RangeFormat_Works_test(app): filepath = PathToTestFile('testy', 'Program.cs') with WrapOmniSharpServer(app, filepath): contents = ReadFile(filepath) request = BuildRequest(command_arguments=['Format'], line_num=11, column_num=2, contents=contents, filetype='cs', filepath=filepath) request['range'] = { 'start': { 'line_num': 8, 'column_num': 1 }, 'end': { 'line_num': 11, 'column_num': 4 } } response = app.post_json('/run_completer_command', request).json print('completer response = ', response) assert_that( response, has_entries({ 'fixits': contains( has_entries({ 'location': LocationMatcher(filepath, 11, 2), 'chunks': contains( ChunkMatcher('\n ', LocationMatcher(filepath, 11, 1), LocationMatcher(filepath, 11, 3)), ChunkMatcher(' ', LocationMatcher(filepath, 10, 1), LocationMatcher(filepath, 10, 4)), ChunkMatcher(' {\n ', LocationMatcher(filepath, 8, 1), LocationMatcher(filepath, 9, 4)), ) })) }))
def Diagnostics_ZeroBasedLineAndColumn_test( app ): filepath = PathToTestFile( 'testy', 'Program.cs' ) with WrapOmniSharpServer( app, filepath ): contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, event_name = 'FileReadyToParse', filetype = 'cs', contents = contents ) results = app.post_json( '/event_notification', event_data ).json assert_that( results, has_items( has_entries( { 'kind': equal_to( 'ERROR' ), 'text': contains_string( "Identifier expected" ), 'location': LocationMatcher( filepath, 10, 12 ), 'location_extent': RangeMatcher( filepath, ( 10, 12 ), ( 10, 12 ) ), } ) ) )
def FileReadyToParse_Diagnostics_InvalidURI_test(app, uri_to_filepath, *args): StartJavaCompleterServerInDirectory(app, PathToTestFile(DEFAULT_PROJECT_DIR)) filepath = TestFactory contents = ReadFile(filepath) # It can take a while for the diagnostics to be ready expiration = time.time() + 10 while True: try: results = _WaitForDiagnosticsToBeReady(app, filepath, contents) print('Completer response: {0}'.format( json.dumps(results, indent=2))) uri_to_filepath.assert_called() assert_that( results, has_item( has_entries({ 'kind': 'WARNING', 'text': 'The value of the field TestFactory.Bar.testString is not ' 'used', 'location': LocationMatcher('', 15, 19), 'location_extent': RangeMatcher('', (15, 19), (15, 29)), 'ranges': contains(RangeMatcher('', (15, 19), (15, 29))), 'fixit_available': False }), )) return except AssertionError: if time.time() > expiration: raise time.sleep(0.25)
def Subcommands_RefactorRename_Unicode_test( app ): unicode_test = PathToTestFile( 'testy', 'Unicode.cs' ) with WrapOmniSharpServer( app, unicode_test ): contents = ReadFile( unicode_test ) request = BuildRequest( completer_target = 'filetype_default', command_arguments = [ 'RefactorRename', 'x' ], line_num = 30, column_num = 31, contents = contents, filetype = 'cs', filepath = unicode_test ) response = app.post_json( '/run_completer_command', request ).json assert_that( response, has_entries( { 'fixits': contains_exactly( has_entries( { 'location': LocationMatcher( unicode_test, 30, 31 ), 'chunks': contains_exactly( has_entries( { 'replacement_text': 'x', 'range': RangeMatcher( unicode_test, ( 30, 29 ), ( 30, 35 ) ) } ) ) } ) ) } ) )
def Diagnostics_WithRange_test( app ): filepath = PathToTestFile( 'testy', 'DiagnosticRange.cs' ) with WrapOmniSharpServer( app, filepath ): contents = ReadFile( filepath ) event_data = BuildRequest( filepath = filepath, event_name = 'FileReadyToParse', filetype = 'cs', contents = contents ) results = app.post_json( '/event_notification', event_data ).json assert_that( results, contains_exactly( has_entries( { 'kind': equal_to( 'WARNING' ), 'text': contains_string( "The variable '\u4e5d' is assigned but its value is never used" ), 'location': LocationMatcher( filepath, 6, 13 ), 'location_extent': RangeMatcher( filepath, ( 6, 13 ), ( 6, 16 ) ) } ) ) )
def Subcommands_RefactorRename_Basic_test( app ): continuous_test = PathToTestFile( 'testy', 'ContinuousTest.cs' ) with WrapOmniSharpServer( app, continuous_test ): contents = ReadFile( continuous_test ) request = BuildRequest( completer_target = 'filetype_default', command_arguments = [ 'RefactorRename', 'x' ], line_num = 5, column_num = 15, contents = contents, filetype = 'cs', filepath = continuous_test ) response = app.post_json( '/run_completer_command', request ).json assert_that( response, has_entries( { 'fixits': contains( has_entries( { 'location': LocationMatcher( continuous_test, 5, 15 ), 'chunks': contains( has_entries( { 'replacement_text': 'x', 'range': RangeMatcher( continuous_test, ( 5, 15 ), ( 5, 29 ) ) } ) ) } ) ) } ) )
def Diagnostics_MultipleMissingIncludes_test( app ): filepath = PathToTestFile( 'multiple_missing_includes.cc' ) contents = ReadFile( filepath ) request = { 'contents': contents, 'filepath': filepath, 'filetype': 'cpp' } test = { 'request': request, 'route': '/receive_messages' } response = RunAfterInitialized( app, test ) pprint( response ) assert_that( response, has_items( has_entries( { 'diagnostics': has_items( has_entries( { 'kind': equal_to( 'ERROR' ), 'location': LocationMatcher( filepath, 1, 10 ), 'text': equal_to( "'first_missing_include' file not found" ), 'fixit_available': False } ) ) } ) ) )
def Diagnostics_FixIt_Available_test( app ): filepath = PathToTestFile( 'FixIt_Clang_cpp11.cpp' ) contents = ReadFile( filepath ) request = { 'contents': contents, 'filepath': filepath, 'filetype': 'cpp' } test = { 'request': request, 'route': '/receive_messages' } response = RunAfterInitialized( app, test ) pprint( response ) assert_that( response, has_items( has_entries( { 'diagnostics': has_items( has_entries( { 'location': LocationMatcher( filepath, 16, 3 ), 'text': contains_string( 'switch condition type \'A\' ' 'requires explicit conversion to \'int\'' ), 'fixit_available': False } ) ) } ) ) )
def Subcommands_GoTo_Basic_test(app): filepath = PathToTestFile('testy', 'GotoTestCase.cs') contents = ReadFile(filepath) event_data = BuildRequest(filepath=filepath, filetype='cs', contents=contents, event_name='FileReadyToParse') app.post_json('/event_notification', event_data) WaitUntilCompleterServerReady(app, 'cs') destination = PathToTestFile('testy', 'Program.cs') goto_data = BuildRequest(completer_target='filetype_default', command_arguments=['GoTo'], line_num=10, column_num=15, contents=contents, filetype='cs', filepath=filepath) response = app.post_json('/run_completer_command', goto_data).json assert_that(response, LocationMatcher(destination, 7, 22))
def Subcommands_FixIt_Simple_test(app): filepath = PathToTestFile('goto.go') fixit = has_entries({ 'fixits': contains_exactly( has_entries({ 'text': "Organize Imports", 'chunks': contains_exactly( ChunkMatcher('', LocationMatcher(filepath, 8, 1), LocationMatcher(filepath, 9, 1)), ChunkMatcher('\tdummy() //GoTo\n', LocationMatcher(filepath, 9, 1), LocationMatcher(filepath, 9, 1)), ChunkMatcher('', LocationMatcher(filepath, 12, 1), LocationMatcher(filepath, 13, 1)), ChunkMatcher('\tdiagnostics_test\n', LocationMatcher(filepath, 13, 1), LocationMatcher(filepath, 13, 1)), ), }), ) }) RunFixItTest(app, 'Only one fixit returned', filepath, 1, 1, fixit)
def test_Diagnostics_ZeroBasedLineAndColumn(self, app): contents = """ void foo() { double baz = "foo"; } // Padding to 5 lines // Padding to 5 lines """ filepath = PathToTestFile('foo.cc') request = { 'contents': contents, 'filepath': filepath, 'filetype': 'cpp' } test = {'request': request, 'route': '/receive_messages'} results = RunAfterInitialized(app, test) assert_that( results, contains_exactly( has_entries({ 'diagnostics': contains_exactly( has_entries({ 'kind': equal_to('ERROR'), 'text': contains_string('Cannot initialize'), 'ranges': contains_exactly( RangeMatcher(filepath, (3, 10), (3, 13))), 'location': LocationMatcher(filepath, 3, 10), 'location_extent': RangeMatcher(filepath, (3, 10), (3, 13)) })) })))