completion_test.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # coding: utf-8
  2. #
  3. # Copyright (C) 2016 YouCompleteMe contributors
  4. #
  5. # This file is part of YouCompleteMe.
  6. #
  7. # YouCompleteMe is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # YouCompleteMe is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
  19. from __future__ import unicode_literals
  20. from __future__ import print_function
  21. from __future__ import division
  22. from __future__ import absolute_import
  23. from future import standard_library
  24. standard_library.install_aliases()
  25. from builtins import * # noqa
  26. from ycm.tests.test_utils import ( CurrentWorkingDirectory, MockVimModule,
  27. MockVimBuffers, VimBuffer )
  28. MockVimModule()
  29. from hamcrest import assert_that, empty, has_entries
  30. from ycm.tests import PathToTestFile, YouCompleteMeInstance
  31. @YouCompleteMeInstance()
  32. def CreateCompletionRequest_UnicodeWorkingDirectory_test( ycm ):
  33. unicode_dir = PathToTestFile( 'uni¢𐍈d€' )
  34. current_buffer = VimBuffer( PathToTestFile( 'uni¢𐍈d€', 'current_buffer' ) )
  35. with CurrentWorkingDirectory( unicode_dir ):
  36. with MockVimBuffers( [ current_buffer ], current_buffer, ( 5, 2 ) ):
  37. ycm.CreateCompletionRequest(),
  38. results = ycm.GetCompletions()
  39. assert_that(
  40. results,
  41. has_entries( {
  42. 'words': empty(),
  43. 'refresh': 'always'
  44. } )
  45. )