From 492a771df3c3248185e8fe3a82392efe8773250e Mon Sep 17 00:00:00 2001 From: Boris Staletic Date: Tue, 13 Feb 2024 21:21:02 +0100 Subject: [PATCH] Fixing tests for go v1.22.0 Latest go version changes how detailed info looks, so we need to change the tests. Opted for matching with a regex, so the test can work with older versions of go as well. --- ycmd/tests/go/get_completions_test.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ycmd/tests/go/get_completions_test.py b/ycmd/tests/go/get_completions_test.py index 255dd8a6d9..760b239756 100644 --- a/ycmd/tests/go/get_completions_test.py +++ b/ycmd/tests/go/get_completions_test.py @@ -15,11 +15,11 @@ # You should have received a copy of the GNU General Public License # along with ycmd. If not, see . -from hamcrest import ( all_of, - assert_that, +from hamcrest import ( assert_that, has_items, has_key, - is_not ) + is_not, + matches_regexp ) from unittest import TestCase from ycmd.tests.go import setUpModule, tearDownModule # noqa @@ -45,16 +45,15 @@ def test_GetCompletions_Basic( self, app ): results = app.post_json( '/completions', completion_data ).json[ 'completions' ] assert_that( results, - all_of( has_items( CompletionEntryMatcher( 'Llongfile', 'int', { - 'detailed_info': 'Llongfile\n\n' + 'detailed_info': matches_regexp( 'Llongfile\n\n' 'These flags define which text to' ' prefix to each log entry generated' - ' by the Logger.', + ' by the \\[?Logger\\]?\\.' ), 'menu_text': 'Llongfile', 'kind': 'Constant', } @@ -70,7 +69,7 @@ def test_GetCompletions_Basic( self, app ): 'menu_text': 'Logger', 'kind': 'Struct', } - ) ) ) ) + ) ) ) # This completer does not require or support resolve