コード例 #1
0
def WriteToPreviewWindow_test(vim_current, vim_command):
    vim_current.window.options.__getitem__ = MagicMock(return_value=True)

    vimsupport.WriteToPreviewWindow("test")

    vim_command.assert_has_exact_calls([
        call('silent! pclose!'),
        call('silent! pedit! _TEMP_FILE_'),
        call('silent! wincmd P'),
        call('silent! wincmd p')
    ])

    vim_current.buffer.__setitem__.assert_called_with(slice(None, None, None),
                                                      ['test'])

    vim_current.buffer.options.__setitem__.assert_has_exact_calls(
        [
            call('modifiable', True),
            call('readonly', False),
            call('buftype', 'nofile'),
            call('swapfile', False),
            call('modifiable', False),
            call('modified', False),
            call('readonly', True),
        ],
        any_order=True)
コード例 #2
0
def WriteToPreviewWindow_JumpFail_test( vim_current, vim_command ):
  vim_current.window.options.__getitem__ = MagicMock( return_value = False )

  vimsupport.WriteToPreviewWindow( "test" )

  vim_command.assert_has_exact_calls( [
    call( 'silent! pclose!' ),
    call( 'silent! pedit! _TEMP_FILE_' ),
    call( 'silent! wincmd P' ),
    call( "echom 'test'" ),
  ] )

  vim_current.buffer.__setitem__.assert_not_called()
  vim_current.buffer.options.__setitem__.assert_not_called()
コード例 #3
0
 def _HandleDetailedInfoResponse(self):
     vimsupport.WriteToPreviewWindow(self._response['detailed_info'])
コード例 #4
0
def WriteToPreviewWindow_MultiLine_test( vim_current ):
  vim_current.window.options.__getitem__ = MagicMock( return_value = True )
  vimsupport.WriteToPreviewWindow( "test\ntest2" )

  vim_current.buffer.__setitem__.assert_called_with(
      slice( None, None, None ), [ 'test', 'test2' ] )