File: 10-add-libclang-test.patch

package info (click to toggle)
vim-youcompleteme 0%2B20240827%2Bgitb6e8c64%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,468 kB
  • sloc: python: 10,914; sh: 204; cpp: 141; makefile: 26; f90: 5; xml: 1
file content (37 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (4)
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
Description: Check that libclang-based completer offers fixit
 clangd is preferred  and more featureful, but libclang is a decent
 fallback and as long as we built it, it should at least keep working.
Author: David Kalnischkies <donkult@debian.org>
Forwarded: not-needed

--- /dev/null
+++ b/test/libclang.test.vim
@@ -0,0 +1,28 @@
+function! SetUp()
+  let g:ycm_auto_trigger = 1
+  let g:ycm_keep_logfiles = 1
+  let g:ycm_log_level = 'DEBUG'
+  let g:ycm_use_clangd = 0
+
+  call youcompleteme#test#setup#SetUp()
+endfunction
+
+function! TearDown()
+  call youcompleteme#test#setup#CleanUp()
+endfunction
+
+function! Test_libclang_Fixit_Works()
+  call youcompleteme#test#setup#OpenFile( '/test/testdata/cpp/fixit.cpp', {} )
+  call setpos( '.', [ 0, 3, 5 ] )
+  call assert_equal( '  printf("%s",1);', getline( '.' ) )
+  function! SelectEntry( id ) closure
+    redraw
+    call test_feedinput( "1\<CR>" )
+  endfunction
+  call timer_start( 2000, funcref( 'SelectEntry' ) )
+  YcmCompleter FixIt
+  redraw
+  call assert_equal( '  printf("%d",1);', getline( 3 ) )
+  %bwipeout!
+  delfunction SelectEntry
+endfunction