File: filesize.test.vim

package info (click to toggle)
vim-youcompleteme 0%2B20230109%2Bgit7620d87%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,404 kB
  • sloc: python: 10,569; sh: 203; cpp: 121; makefile: 24; f90: 5; xml: 1
file content (46 lines) | stat: -rw-r--r-- 1,163 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
38
39
40
41
42
43
44
45
46
function! SetUp()
  let g:ycm_use_clangd = 1
  let g:ycm_confirm_extra_conf = 0
  let g:ycm_auto_trigger = 1
  let g:ycm_keep_logfiles = 1
  let g:ycm_always_populate_location_list = 1

  " diagnostics take ages
  let g:ycm_test_min_delay = 7 
  call youcompleteme#test#setup#SetUp()
endfunction

function! TearDown()
  call youcompleteme#test#setup#CleanUp()
endfunction

function! Test_Open_Unsupported_Filetype_Messages()
  messages clear
  enew

  let X = join( map( range( 0, 1000 * 1024 + 1 ), {->'X'} ), '' )
  call append( line( '$' ), X )

  silent w! Xtest

  let l:stderr = substitute( execute( '1messages' ), '\n', '\t', 'g' )
  call assert_notmatch( 'the file exceeded the max size', stderr )
  call delete( 'Xtest' )
endfunction

function! Test_Open_Supported_Filetype_Messages()
  enew

  let X = join( map( range( 0, 1000 * 1024 + 1 ), {->'X'} ), '' )
  call append( line( '$' ), X )

  silent w! Xtest
  setf cpp

  let l:stderr = substitute( execute( '1messages' ), '\n', '\t', 'g' )
  call assert_match( 'the file exceeded the max size', stderr )
  call assert_equal( 1, b:ycm_largefile )
  messages clear

  call delete( 'Xtest' )
endfunction