filesize.test.vim 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. function! SetUp()
  2. let g:ycm_use_clangd = 1
  3. let g:ycm_confirm_extra_conf = 0
  4. let g:ycm_auto_trigger = 1
  5. let g:ycm_keep_logfiles = 1
  6. let g:ycm_always_populate_location_list = 1
  7. " diagnostics take ages
  8. let g:ycm_test_min_delay = 7
  9. call youcompleteme#test#setup#SetUp()
  10. endfunction
  11. function! TearDown()
  12. call youcompleteme#test#setup#CleanUp()
  13. endfunction
  14. function! Test_Open_Unsupported_Filetype_Messages()
  15. messages clear
  16. enew
  17. let X = join( map( range( 0, 1000 * 1024 + 1 ), {->'X'} ), '' )
  18. call append( line( '$' ), X )
  19. silent w! Xtest
  20. let l:stderr = substitute( execute( '1messages' ), '\n', '\t', 'g' )
  21. call assert_notmatch( 'the file exceeded the max size', stderr )
  22. call delete( 'Xtest' )
  23. endfunction
  24. function! Test_Open_Supported_Filetype_Messages()
  25. enew
  26. let X = join( map( range( 0, 1000 * 1024 + 1 ), {->'X'} ), '' )
  27. call append( line( '$' ), X )
  28. silent w! Xtest
  29. setf cpp
  30. let l:stderr = substitute( execute( '1messages' ), '\n', '\t', 'g' )
  31. call assert_match( 'the file exceeded the max size', stderr )
  32. call assert_equal( 1, b:ycm_largefile )
  33. messages clear
  34. call delete( 'Xtest' )
  35. endfunction