File: 07-support-different-ycmds-in-tests.patch

package info (click to toggle)
vim-youcompleteme 0%2B20240827%2Bgitb6e8c64%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,436 kB
  • sloc: python: 10,914; sh: 204; cpp: 141; makefile: 26; f90: 5; xml: 1
file content (105 lines) | stat: -rw-r--r-- 3,140 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Description: Support different ycmd versions in tests
 Similar to previous patch dealing with different clang (and related)
 versions this one deals with different versions of ycmd causing
 differences in the tests so that I can avoid lock-stepping the two
 even if in practice usually the newest of both will run together.
 .
 If its more than simple hard-to-observe/cosmetic changes upstream
 usually uses an increase in CORE_VERSION instead which we can follow.
 .
 For upstream the changes are at best not-needed, but at times I take
 a shortcut and relax the tests which for upstream isn't appropriate,
 but for us it should be good enough for the time being.
Author: David Kalnischkies <donkult@debian.org>
Forwarded: not-needed

--- a/test/diagnostics.test.vim
+++ b/test/diagnostics.test.vim
@@ -250,9 +250,9 @@
   YcmShowDetailedDiagnostic
   redir END
 
-  call assert_equal(
-        \ "Format specifies type 'char *' but the argument has type 'int' "
-        \ . '(fix available) [-Wformat]',
+  call assert_match(
+        \ "^Format specifies type 'char \\\*' but the argument has type 'int' "
+        \ . '(fix available)',
         \ trim( output ) )
 
   %bwipe!
@@ -266,6 +266,9 @@
   YcmShowDetailedDiagnostic popup
 
   let id = popup_locate( 4, 16 )
+  if id == 0
+    let id = popup_locate( 4, 1 )
+  endif
   call assert_notequal(
         \ 0,
         \ id,
@@ -278,15 +281,13 @@
 
   call youcompleteme#test#popup#CheckPopupPosition( id, {
         \ 'visible': 1,
-        \ 'col': 16,
+        \ 'col': [1, 16],
         \ 'line': 4,
         \ } )
-  call assert_equal(
-        \ [
-        \   "Format specifies type 'char *' but the argument has type 'int' "
-        \   . '(fix available) [-Wformat]',
-        \ ],
-        \ getbufline( winbufnr(id), 1, '$' ) )
+  call assert_match(
+        \ "^Format specifies type 'char \\\*' but the argument has type 'int' "
+        \ . '(fix available)',
+        \ getbufline( winbufnr(id), 1, '$' )[ 0 ] )
 
   " From vim's test_popupwin.vim
   " trigger the check for last_cursormoved by going into insert mode
@@ -320,6 +321,9 @@
   YcmShowDetailedDiagnostic popup
 
   let id = popup_locate( 5, 7 )
+  if id == 0
+    let id = popup_locate( 5, 1 )
+  endif
   call assert_notequal(
         \ 0,
         \ id,
@@ -332,7 +336,7 @@
 
   call youcompleteme#test#popup#CheckPopupPosition( id, {
         \ 'visible': 1,
-        \ 'col': 7,
+        \ 'col': [1, 7],
         \ 'line': 5,
         \ } )
   call assert_match(
--- a/test/lib/plugin/shared.vim
+++ b/test/lib/plugin/shared.vim
@@ -19,6 +19,12 @@
   endif
 endfunction
 
+func SkipYcmdGtEq( version )
+  if $YCMD_VERSION == '' || $YCMD_VERSION < a:version
+    throw 'SKIPPED: Test requires ycmd >= ' . a:version
+  endif
+endfunction
+
 func SkipJava()
   throw 'SKIPPED: Java completer not supported in Debian yet'
 endfunction
--- a/test/run_vim_tests
+++ b/test/run_vim_tests
@@ -24,6 +24,7 @@
 
 RUN_VIM="${VIM} --clean --not-a-term"
 RUN_TEST="${RUN_VIM} -S lib/run_test.vim"
+export YCMD_VERSION="$(dpkg-query --show --showformat='${Version}' ycmd)"
 
 pushd $(dirname $0) > /dev/null