コード例 #1
0
 def GoToTest( command, response ):
   with patch( 'icm.vimsupport.JumpToLocation' ) as jump_to_location:
     request = CommandRequest( [ command ] )
     request._response = response
     request.RunPostCommandActionsIfNeeded()
     jump_to_location.assert_called_with(
         response[ 'filepath' ],
         response[ 'line_num' ],
         response[ 'column_num' ] )
コード例 #2
0
 def GoToListTest( command, response ):
   # Note: the detail of these called are tested by
   # GoToResponse_QuickFix_test, so here we just check that the right call is
   # made
   with patch( 'icm.vimsupport.SetQuickFixList' ) as set_qf_list:
     with patch( 'icm.vimsupport.OpenQuickFixList' ) as open_qf_list:
       request = CommandRequest( [ command ] )
       request._response = response
       request.RunPostCommandActionsIfNeeded()
       ok_( set_qf_list.called )
       ok_( open_qf_list.called )
コード例 #3
0
    def FixItTest( command, response, chunks, selection ):
      with patch( 'icm.vimsupport.ReplaceChunks' ) as replace_chunks:
        with patch( 'icm.vimsupport.PostVimMessage' ) as post_vim_message:
          with patch( 'icm.vimsupport.SelectFromList',
                      return_value = selection ):
            request = CommandRequest( [ command ] )
            request._response = response
            request.RunPostCommandActionsIfNeeded()

            replace_chunks.assert_called_with( chunks )
            post_vim_message.assert_not_called()
コード例 #4
0
    def EmptyFixItTest( command ):
      with patch( 'icm.vimsupport.ReplaceChunks' ) as replace_chunks:
        with patch( 'icm.vimsupport.PostVimMessage' ) as post_vim_message:
          request = CommandRequest( [ command ] )
          request._response = {
            'fixits': []
          }
          request.RunPostCommandActionsIfNeeded()

          post_vim_message.assert_called_with(
            'No fixits found for current line', warning = False )
          replace_chunks.assert_not_called()
コード例 #5
0
 def DetailedInfoTest( command, info ):
   with patch( 'icm.vimsupport.WriteToPreviewWindow' ) as write_to_preview:
     request = CommandRequest( [ command ] )
     request._response = { 'detailed_info': info }
     request.RunPostCommandActionsIfNeeded()
     write_to_preview.assert_called_with( info )
コード例 #6
0
 def MessageTest( command, message ):
   with patch( 'icm.vimsupport.PostVimMessage' ) as post_vim_message:
     request = CommandRequest( [ command ] )
     request._response = { 'message': message }
     request.RunPostCommandActionsIfNeeded()
     post_vim_message.assert_called_with( message, warning = False )
コード例 #7
0
 def _BasicResponseTest( command, response ):
   with patch( 'vim.command' ) as vim_command:
     request = CommandRequest( [ command ] )
     request._response = response
     request.RunPostCommandActionsIfNeeded()
     vim_command.assert_called_with( "echo '{0}'".format( response ) )