def EventNotification_FileReadyToParse_TagFiles_UnicodeWorkingDirectory_test(
    add_ultisnips_data_if_needed, ycm ):
  unicode_dir = PathToTestFile( 'uni¢𐍈d€' )
  current_buffer_file = PathToTestFile( 'uni¢𐍈d€', 'current_buffer' )
  current_buffer = VimBuffer( name = current_buffer_file,
                              contents = [ 'current_buffer_contents' ],
                              filetype = 'some_filetype' )

  with patch( 'ycm.client.event_notification.EventNotification.'
              'PostDataToHandlerAsync' ) as post_data_to_handler_async:
    with CurrentWorkingDirectory( unicode_dir ):
      with MockVimBuffers( [ current_buffer ], [ current_buffer ], ( 1, 5 ) ):
        ycm.OnFileReadyToParse()

    assert_that(
      # Positional arguments passed to PostDataToHandlerAsync.
      post_data_to_handler_async.call_args[ 0 ],
      contains_exactly(
        has_entries( {
          'filepath': current_buffer_file,
          'line_num': 1,
          'column_num': 6,
          'file_data': has_entries( {
            current_buffer_file: has_entries( {
              'contents': 'current_buffer_contents\n',
              'filetypes': [ 'some_filetype' ]
            } )
          } ),
          'event_name': 'FileReadyToParse',
          'tag_files': has_item( PathToTestFile( 'uni¢𐍈d€', 'tags' ) )
        } ),
        'event_notification'
      )
    )
Exemplo n.º 2
0
def CreateCompletionRequest_UnicodeWorkingDirectory_test(ycm):
    unicode_dir = PathToTestFile('uni¢𐍈d€')
    current_buffer = VimBuffer(PathToTestFile('uni¢𐍈d€', 'current_buffer'))

    with CurrentWorkingDirectory(unicode_dir):
        with MockVimBuffers([current_buffer], current_buffer):
            ycm.CreateCompletionRequest(),

        results = ycm.GetCompletions()

    assert_that(results, has_entries({'words': empty(), 'refresh': 'always'}))
Exemplo n.º 3
0
def SendCompletionRequest_UnicodeWorkingDirectory_test(ycm):
    unicode_dir = PathToTestFile('uni¢𐍈d€')
    current_buffer = VimBuffer(PathToTestFile('uni¢𐍈d€', 'current_buffer'))

    def ServerResponse(*args):
        return {'completions': [], 'completion_start_column': 1}

    with CurrentWorkingDirectory(unicode_dir):
        with MockVimBuffers([current_buffer], [current_buffer]):
            with MockCompletionRequest(ServerResponse):
                ycm.SendCompletionRequest()
                ok_(ycm.CompletionRequestReady())
                assert_that(
                    ycm.GetCompletionResponse(),
                    has_entries({
                        'completions': empty(),
                        'completion_start_column': 1
                    }))