Skip to content

Commit

Permalink
Add test for completion of tags as identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
vheon committed Nov 3, 2016
1 parent b53fee4 commit 6b957a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ycmd/tests/get_completions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
standard_library.install_aliases()
from builtins import * # noqa

import os
from hamcrest import assert_that, equal_to, has_items, contains_string
from mock import patch
from nose.tools import eq_

from ycmd.tests import SharedYcmd
from ycmd.tests import SharedYcmd, PathToTestFile
from ycmd.tests.test_utils import ( BuildRequest, CompletionEntryMatcher,
DummyCompleter, PatchCompleter,
UserOption, ExpectedFailure )
Expand Down Expand Up @@ -193,6 +194,22 @@ def GetCompletions_IdentifierCompleter_SyntaxKeywordsAdded_test( app ):
CompletionEntryMatcher( 'zoo' ) ) )


@SharedYcmd
def GetCompletions_IdentifierCompleter_TagsAdded_test( app ):
event_data = BuildRequest( event_name = 'FileReadyToParse',
tag_files = [ PathToTestFile( 'basic.tags' ) ] )
app.post_json( '/event_notification', event_data )

completion_data = BuildRequest( contents = 'oo',
column_num = 3,
filetype = 'cpp' )
results = app.post_json( '/completions',
completion_data ).json[ 'completions' ]
assert_that( results,
has_items( CompletionEntryMatcher( 'foosy' ),
CompletionEntryMatcher( 'fooaaa' ) ) )


@SharedYcmd
def GetCompletions_UltiSnipsCompleter_Works_test( app ):
event_data = BuildRequest(
Expand Down
10 changes: 10 additions & 0 deletions ycmd/tests/testdata/basic.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 2 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /[email protected]/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
i1 foo junky;'junklanguage:C++
i1 bar junky;'junklanguage:C++
foosy foo junky;"'junk language:C++ zanzibar
fooaaa bar junky;"'junk language:C++ zanzibar

0 comments on commit 6b957a9

Please sign in to comment.