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
|
Description: Ignore architecture-specific details in hover vim-test
Offset and Padding are different on e.g. i386 vs. amd64,
so we go from exact matching to manually comparing arrays of lines
of text which we match individually against an expected pattern.
For most lines, that will be a fixed string as before, but for
the offending two we will accept any number in place of a fixed one.
Author: David Kalnischkies <donkult@debian.org>
Forwarded: no
--- a/test/hover.test.vim
+++ b/test/hover.test.vim
@@ -31,8 +31,13 @@
\ } )
let popup = popup_locate( a:loc.row, a:loc.col )
if a:text isnot v:none
- call assert_equal( a:text,
- \ getbufline( winbufnr( popup ), 1, '$' ) )
+ let popcontent = getbufline( winbufnr( popup ), 1, '$' )
+ call assert_equal( len(a:text), len(popcontent) )
+ let i = 0
+ while i < len(a:text)
+ call assert_match( a:text[i], popcontent[i] )
+ let i += 1
+ endwhile
endif
call assert_equal( a:syntax, getbufvar( winbufnr( popup ), '&syntax' ) )
endfunction
@@ -63,20 +68,20 @@
endfunction
let s:python_oneline = {
- \ 'GetDoc': [ 'Test_OneLine()', '', 'This is the one line output.' ],
- \ 'GetType': [ 'def Test_OneLine()' ],
+ \ 'GetDoc': [ '^Test_OneLine()$', '^$', '^This is the one line output.$' ],
+ \ 'GetType': [ '^def Test_OneLine()$' ],
\ }
let s:cpp_lifetime = {
- \ 'GetDoc': [ 'field lifetime',
- \ '',
- \ 'Type: char',
- \ 'Offset: 16 bytes',
- \ 'Size: 1 byte (+7 bytes padding), alignment 1 byte',
- \ 'nobody will live > 128 years',
- \ '',
- \ '// In PointInTime',
- \ 'public: char lifetime' ],
- \ 'GetType': [ 'public: char lifetime; // In PointInTime' ],
+ \ 'GetDoc': [ '^field lifetime$',
+ \ '^$',
+ \ '^Type: char$',
+ \ '^Offset: \d\+ bytes$',
+ \ '^Size: 1 byte (+\d\+ \(byte\(s\|\) \|\)padding)\(, alignment \d\+ byte\(s\|\)\|\)$',
+ \ '^nobody will live > 128 years$',
+ \ '^$',
+ \ '^// In PointInTime$',
+ \ '^public: char lifetime$' ],
+ \ 'GetType': [ '^public: char lifetime; // In PointInTime$' ],
\ }
function! SetUp()
|