workflow.vader 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. Execute (Initialize test environment):
  2. Save &rtp, g:plugs, g:plug_home, $MYVIMRC
  3. let first_rtp = split(&rtp, ',')[0]
  4. let last_rtp = split(&rtp, ',')[-1]
  5. let vader = fnamemodify(globpath(&rtp, 'autoload/vader.vim'), ':h:h')
  6. let plug = fnamemodify(globpath(&rtp, 'autoload/plug.vim'), ':h:h')
  7. set rtp=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
  8. execute 'set rtp^='.vader
  9. execute 'set rtp^='.plug
  10. let basertp = &rtp
  11. unlet! g:plugs
  12. unlet! g:plug_home
  13. set t_Co=256
  14. colo default
  15. pclose
  16. function! PlugStatusSorted()
  17. PlugStatus
  18. %y
  19. q
  20. normal! P
  21. %sort
  22. g/^$/d
  23. endfunction
  24. function! AssertExpect(bang, pat, cnt)
  25. let op = a:bang ? '==' : '=~'
  26. AssertEqual a:cnt, len(filter(getline(1, '$'), "v:val ".op." '".a:pat."'"))
  27. endfunction
  28. command! -nargs=+ -bang AssertExpect call AssertExpect('<bang>' == '!', <args>)
  29. let g:vimrc_reloaded = 0
  30. let vimrc = tempname()
  31. call writefile(['let g:vimrc_reloaded += 1'], vimrc)
  32. let $MYVIMRC = vimrc
  33. Execute (plug#end() before plug#begin() should fail):
  34. redir => out
  35. AssertEqual 0, plug#end()
  36. redir END
  37. Assert stridx(out, 'Call plug#begin() first') >= 0
  38. Execute (plug#begin() without path argument):
  39. call plug#begin()
  40. AssertEqual split(&rtp, ',')[0].'/plugged', g:plug_home
  41. unlet g:plug_home
  42. Execute (plug#begin() without path argument with empty &rtp):
  43. let save_rtp = &rtp
  44. set rtp=
  45. redir => out
  46. AssertEqual 0, plug#begin()
  47. redir END
  48. Assert stridx(out, 'Unable to determine plug home') >= 0
  49. let &rtp = save_rtp
  50. Execute (plug#begin(path)):
  51. let temp_plugged = tempname()
  52. call plug#begin(temp_plugged.'/')
  53. Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
  54. AssertEqual 0, len(g:plugs)
  55. AssertEqual temp_plugged, g:plug_home
  56. AssertEqual basertp, &rtp
  57. Execute (Subsequent plug#begin() calls will reuse g:plug_home):
  58. call plug#begin()
  59. AssertEqual temp_plugged, g:plug_home
  60. Execute (Test Plug command):
  61. " Git repo with branch
  62. Plug 'junegunn/seoul256.vim', 'yes-t_co'
  63. AssertEqual 'https://git:@github.com/junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
  64. AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
  65. AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
  66. Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
  67. AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
  68. " Git repo with tag
  69. Plug 'junegunn/goyo.vim', '1.5.2'
  70. AssertEqual 'https://git:@github.com/junegunn/goyo.vim.git', g:plugs['goyo.vim'].uri
  71. AssertEqual join([temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
  72. AssertEqual '1.5.2', g:plugs['goyo.vim'].branch
  73. Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
  74. AssertEqual '1.5.3', g:plugs['goyo.vim'].branch
  75. " Git URI
  76. Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
  77. AssertEqual 'https://bitbucket.org/junegunn/vim-emoji.git', g:plugs['vim-emoji'].uri
  78. AssertEqual 'master', g:plugs['vim-emoji'].branch
  79. AssertEqual join([temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
  80. " vim-scripts/
  81. Plug 'beauty256'
  82. AssertEqual 'https://git:@github.com/vim-scripts/beauty256.git', g:plugs.beauty256.uri
  83. AssertEqual 'master', g:plugs.beauty256.branch
  84. AssertEqual 4, len(g:plugs)
  85. Execute (Plug command with dictionary option):
  86. Log string(g:plugs)
  87. Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
  88. AssertEqual join([temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
  89. AssertEqual '././', g:plugs['seoul256.vim'].rtp
  90. Log string(g:plugs)
  91. AssertEqual 4, len(g:plugs)
  92. Execute (PlugStatus before installation):
  93. PlugStatus
  94. AssertExpect 'Not found', 4
  95. q
  96. Execute (PlugClean before installation):
  97. PlugClean
  98. AssertExpect 'Already clean', 1
  99. q
  100. Execute (plug#end() updates &rtp):
  101. call plug#end()
  102. Assert len(&rtp) > len(basertp)
  103. AssertEqual first_rtp, split(&rtp, ',')[0]
  104. AssertEqual last_rtp, split(&rtp, ',')[-1]
  105. Execute (Yet, plugins are not available):
  106. Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
  107. Execute (PlugInstall):
  108. PlugInstall
  109. AssertEqual 1, g:vimrc_reloaded
  110. q
  111. Execute (Plugin available after installation):
  112. Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
  113. Execute (PlugClean after installation):
  114. PlugClean
  115. AssertExpect 'Already clean', 1
  116. q
  117. Execute (PlugStatus after installation):
  118. PlugStatus
  119. Log getline(1, '$')
  120. AssertExpect 'OK', 4
  121. q
  122. Execute (Change tag of goyo.vim):
  123. call plug#begin()
  124. Plug 'junegunn/goyo.vim'
  125. call plug#end()
  126. Execute (PlugStatus):
  127. call PlugStatusSorted()
  128. Expect:
  129. Invalid branch/tag: 1.5.3 (expected: master). Try PlugUpdate.
  130. Finished. 1 error(s).
  131. [=]
  132. x goyo.vim:
  133. Execute (PlugUpdate to set the right branch):
  134. PlugUpdate
  135. call PlugStatusSorted()
  136. AssertEqual 2, g:vimrc_reloaded
  137. Expect:
  138. - goyo.vim: OK
  139. Finished. 0 error(s).
  140. [=]
  141. Execute (Change branch of seoul256.vim):
  142. call plug#begin()
  143. Plug 'junegunn/seoul256.vim'
  144. Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
  145. call plug#end()
  146. Execute (PlugStatus):
  147. call PlugStatusSorted()
  148. Expect:
  149. Invalid branch/tag: no-t_co (expected: master). Try PlugUpdate.
  150. - vim-emoji: OK
  151. Finished. 1 error(s).
  152. [==]
  153. x seoul256.vim:
  154. Execute (Change URI of seoul256.vim):
  155. call plug#begin()
  156. Plug 'junegunn.choi/seoul256.vim'
  157. Plug 'https://bitbucket.org/junegunn/vim-emoji.git'
  158. call plug#end()
  159. Execute (PlugStatus):
  160. call PlugStatusSorted()
  161. Expect:
  162. Expected: https://git:@github.com/junegunn.choi/seoul256.vim.git
  163. Invalid URI: https://git:@github.com/junegunn/seoul256.vim.git
  164. PlugClean required.
  165. - vim-emoji: OK
  166. Finished. 1 error(s).
  167. [==]
  168. x seoul256.vim:
  169. # TODO: does not work due to inputsave()
  170. # Do (PlugClean):
  171. # :PlugClean\<Enter>y\<Enter>
  172. # ggyG
  173. # q
  174. # PGdd
  175. Execute (PlugClean! to remove seoul256.vim):
  176. PlugClean!
  177. " Three removed, emoji left
  178. AssertExpect '^- ', 3
  179. AssertExpect 'Removed', 1
  180. Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
  181. Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
  182. q
  183. Execute (Change GIT URI of vim-emoji):
  184. call plug#begin()
  185. Plug 'junegunn/seoul256.vim'
  186. Plug 'junegunn/vim-emoji'
  187. call plug#end()
  188. Execute (PlugStatus):
  189. call PlugStatusSorted()
  190. Expect:
  191. Expected: https://git:@github.com/junegunn/vim-emoji.git
  192. Invalid URI: https://bitbucket.org/junegunn/vim-emoji.git
  193. Not found. Try PlugInstall.
  194. PlugClean required.
  195. Finished. 2 error(s).
  196. [==]
  197. x seoul256.vim:
  198. x vim-emoji:
  199. Execute (PlugClean! to remove vim-emoji):
  200. PlugClean!
  201. AssertExpect '^- ', 1
  202. AssertExpect 'Removed', 1
  203. Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
  204. Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
  205. q
  206. Execute (PlugUpdate to install both again):
  207. PlugUpdate
  208. AssertExpect '^- [^:]*:', 2
  209. AssertEqual 3, g:vimrc_reloaded
  210. Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
  211. Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
  212. q
  213. Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
  214. PlugUpdate
  215. AssertExpect 'Already up-to-date', 2
  216. AssertEqual 4, g:vimrc_reloaded
  217. normal D
  218. AssertEqual 'No updates.', getline(1)
  219. q
  220. Execute (PlugDiff - 'No updates.'):
  221. PlugDiff
  222. AssertEqual 'No updates.', getline(1)
  223. q
  224. Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
  225. for repo in ['seoul256.vim', 'vim-emoji']
  226. call system(printf('cd %s/%s && git reset HEAD^^ --hard', g:plug_home, repo))
  227. endfor
  228. PlugUpdate
  229. " Now we have updates
  230. normal D
  231. AssertEqual 'Last update:', getline(1)
  232. " Preview commit
  233. silent! wincmd P
  234. AssertEqual 0, &previewwindow
  235. " ]] motion
  236. execute 'normal ]]'
  237. let lnum = line('.')
  238. AssertEqual 3, col('.')
  239. " Open commit preview
  240. execute "normal j\<cr>"
  241. wincmd P
  242. AssertEqual 1, &previewwindow
  243. AssertEqual 'git', &filetype
  244. " Back to plug window
  245. wincmd p
  246. " ]] motion
  247. execute 'normal $]]'
  248. AssertEqual lnum + 4, line('.')
  249. AssertEqual 3, col('.')
  250. " [[ motion
  251. execute 'normal 0[['
  252. AssertEqual lnum, line('.')
  253. AssertEqual 3, col('.')
  254. " q will close preview window as well
  255. normal q
  256. " We no longer have preview window
  257. silent! wincmd P
  258. AssertEqual 0, &previewwindow
  259. " q should not close preview window if it's already open
  260. pedit
  261. PlugDiff
  262. execute "normal ]]j\<cr>"
  263. normal q
  264. silent! wincmd P
  265. AssertEqual 1, &previewwindow
  266. pclose
  267. Execute (Plug window in a new tab):
  268. PlugDiff
  269. tab new new-tab
  270. set buftype=nofile
  271. PlugUpdate
  272. normal D
  273. AssertEqual 'No updates.', getline(1)
  274. q
  275. AssertEqual 'new-tab', expand('%')
  276. q
  277. q
  278. **********************************************************************
  279. ~ On-demand loading / Partial installation/update ~
  280. **********************************************************************
  281. Execute (Trying to execute on-demand commands when plugin is not installed):
  282. call plug#begin()
  283. Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign'] }
  284. call plug#end()
  285. Assert exists(':EasyAlign')
  286. Assert exists(':LiveEasyAlign')
  287. AssertThrows EasyAlign
  288. AssertThrows LiveEasyAlign
  289. Assert !exists(':EasyAlign')
  290. Assert !exists(':LiveEasyAlign')
  291. Execute (New set of plugins):
  292. call plug#begin()
  293. Plug 'junegunn/vim-fnr' " Depends on vim-pseudocl
  294. Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
  295. Plug 'junegunn/vim-redis', { 'for': 'redis' }
  296. call plug#end()
  297. Execute (Check commands):
  298. Assert !exists(':FNR'), 'FNR command should not be found'
  299. Assert !exists(':RedisExecute'), 'RedisExecute command should not be found'
  300. Execute (Partial PlugInstall):
  301. PlugInstall vim-fnr vim-easy-align
  302. AssertExpect 'vim-pseudocl', 1
  303. PlugInstall vim-fnr vim-easy-align 1
  304. AssertExpect 'vim-pseudocl', 1
  305. q
  306. Execute (Check dependent plugin):
  307. Assert &rtp =~ 'pseudocl', &rtp
  308. AssertEqual first_rtp, split(&rtp, ',')[0]
  309. AssertEqual last_rtp, split(&rtp, ',')[-1]
  310. Given (Unaligned code):
  311. a=1
  312. aa=2
  313. Execute (Check installed plugins):
  314. Assert exists(':FNR'), 'FNR command should be found'
  315. Assert exists(':EasyAlign'), 'EasyAlign command should be found'
  316. Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
  317. %EasyAlign=
  318. Expect (Aligned code):
  319. a = 1
  320. aa = 2
  321. Given:
  322. Execute (Partial PlugUpdate):
  323. PlugUpdate vim-redis
  324. q
  325. Execute (On-demand loading based on filetypes):
  326. Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
  327. set ft=redis
  328. Assert exists(':RedisExecute'), 'RedisExecute command is now found'
  329. **********************************************************************
  330. ~ Local (unmanaged) plugins
  331. **********************************************************************
  332. Execute (Add unmanaged plugin):
  333. let fzf = fnamemodify(g:vader_file, ':h') . '/fzf'
  334. Log fzf
  335. call plug#begin()
  336. Plug fzf, { 'on': 'SomeCommand' }
  337. call plug#end()
  338. " Check uri field
  339. Assert !has_key(g:plugs.fzf, 'uri'), 'Should not have uri field'
  340. " Check dir field
  341. AssertEqual fzf.'/', g:plugs.fzf.dir
  342. " Trailing slashes and backslashes should be stripped
  343. for suffix in ['///', '/\/\/']
  344. call plug#begin()
  345. Plug fzf.suffix, { 'on': 'SomeCommand' }
  346. call plug#end()
  347. " Check dir field
  348. AssertEqual fzf.'/', g:plugs.fzf.dir
  349. endfor
  350. Execute (Plug block for following tests):
  351. call plug#begin()
  352. Plug 'junegunn/vim-easy-align'
  353. Plug fzf, { 'on': 'SomeCommand' }
  354. call plug#end()
  355. " Remove plugins from previous tests
  356. PlugClean!
  357. Execute (PlugInstall will only install vim-easy-align):
  358. PlugInstall
  359. Log getline(1, '$')
  360. AssertExpect 'fzf', 0
  361. q
  362. Execute (PlugUpdate will only update vim-easy-align):
  363. PlugUpdate
  364. Log getline(1, '$')
  365. AssertExpect 'fzf', 0
  366. q
  367. Execute (PlugClean should not care about unmanaged plugins):
  368. PlugClean
  369. Log getline(1, '$')
  370. AssertExpect 'fzf', 0
  371. q
  372. Execute (PlugStatus should point out that the plugin is missing):
  373. PlugStatus
  374. Log getline(1, '$')
  375. AssertExpect 'x fzf', 1
  376. AssertExpect 'Not found', 1
  377. q
  378. Execute (Deploy unmanaged plugin):
  379. Assert !exists(':FZF'), ':FZF command should not exist'
  380. call rename('fzf-staged', 'fzf')
  381. Execute (PlugUpdate still should not care):
  382. PlugUpdate
  383. Log getline(1, '$')
  384. AssertExpect 'fzf', 0
  385. q
  386. Execute (PlugStatus with no error):
  387. PlugStatus
  388. Log getline(1, '$')
  389. AssertExpect 'x fzf', 0
  390. AssertExpect 'Not found', 0
  391. q
  392. Execute (Check &rtp after SomeCommand):
  393. Log &rtp
  394. Assert &rtp !~ 'fzf'
  395. silent! SomeCommand
  396. Assert &rtp =~ 'fzf'
  397. AssertEqual first_rtp, split(&rtp, ',')[0]
  398. AssertEqual last_rtp, split(&rtp, ',')[-1]
  399. Execute (Common parent):
  400. call plug#begin()
  401. Plug 'junegunn/vim-pseudocl'
  402. Plug 'junegunn/vim-fnr'
  403. Plug 'junegunn/vim-oblique'
  404. call plug#end()
  405. PlugInstall
  406. Log getline(1, '$')
  407. AssertExpect! '[===]', 1
  408. q
  409. **********************************************************************
  410. ~ Frozen plugins
  411. **********************************************************************
  412. Execute (Frozen plugin are not installed nor updated):
  413. call plug#begin()
  414. Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
  415. call plug#end()
  416. redir => output
  417. silent PlugInstall
  418. redir END
  419. Assert output =~ 'No plugin to install'
  420. redir => output
  421. silent PlugUpdate
  422. redir END
  423. Assert output =~ 'No plugin to update'
  424. Execute (But you can still install it if the name is given as the argument):
  425. PlugInstall vim-easy-align
  426. Log getline(1, '$')
  427. AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
  428. q
  429. PlugUpdate vim-easy-align
  430. Log getline(1, '$')
  431. AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
  432. q
  433. **********************************************************************
  434. ~ Retry
  435. **********************************************************************
  436. Execute (Retry failed tasks):
  437. call plug#begin()
  438. Plug 'junegunn/vim-easy-align'
  439. Plug 'junegunn/aaaaaaaaaaaaaa'
  440. call plug#end()
  441. PlugInstall
  442. Log getline(1, '$')
  443. AssertExpect 'x aaa', 1
  444. AssertExpect '- vim-easy-align', 1
  445. normal R
  446. Log getline(1, '$')
  447. AssertExpect 'x aaa', 1
  448. AssertExpect '- vim-easy-align', 0
  449. AssertExpect! '[x]', 1
  450. q
  451. call plug#begin()
  452. Plug 'junegunn/vim-easy-align'
  453. Plug 'junegunn/aaaaaaaaaaaaaa'
  454. Plug 'junegunn/bbbbbbbbbbbbbb'
  455. Plug 'junegunn/cccccccccccccc'
  456. call plug#end()
  457. " Ruby installer
  458. PlugUpdate
  459. normal R
  460. AssertExpect '- vim-easy-align', 0
  461. AssertExpect! '[xxx]', 1
  462. q
  463. " Vim installer
  464. PlugUpdate 1
  465. normal R
  466. AssertExpect '- vim-easy-align', 0
  467. AssertExpect! '[xxx]', 1
  468. q
  469. **********************************************************************
  470. ~ Post-update hook (`do` option)
  471. **********************************************************************
  472. Execute (Cleanup):
  473. call plug#begin()
  474. call plug#end()
  475. PlugClean!
  476. Execute (On install):
  477. call plug#begin()
  478. Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
  479. Plug 'junegunn/vim-pseudocl'
  480. call plug#end()
  481. PlugInstall
  482. q
  483. Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed'),
  484. \ 'vim-easy-align/installed should exist'
  485. Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'),
  486. \ 'vim-pseudocl/installed should not exist'
  487. Execute (On update):
  488. call plug#begin()
  489. Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' }
  490. Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
  491. call plug#end()
  492. " Reset for updates
  493. call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')
  494. PlugUpdate
  495. Log getline(1, '$')
  496. q
  497. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated'),
  498. \ 'vim-easy-align/updated should not exist'
  499. Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated'),
  500. \ 'vim-pseudocl/updated should exist'
  501. Execute (When already installed):
  502. call plug#begin()
  503. Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' }
  504. Plug 'junegunn/vim-pseudocl', { 'do': 'touch installed2' }
  505. call plug#end()
  506. PlugInstall
  507. q
  508. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
  509. \ 'vim-easy-align/installed2 should not exist'
  510. Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed2'),
  511. \ 'vim-pseudocl/installed2 should exist'
  512. Execute (When already updated):
  513. call plug#begin()
  514. Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' }
  515. Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated2' }
  516. call plug#end()
  517. PlugUpdate
  518. q
  519. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
  520. \ 'vim-easy-align/updated2 should not exist'
  521. Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/updated2'),
  522. \ 'vim-pseudocl/updated2 should exist'
  523. Execute (Using Funcref):
  524. function! PlugUpdated(info)
  525. call system('touch '. a:info.name . a:info.status . len(a:info))
  526. endfunction
  527. call plug#begin()
  528. Plug 'junegunn/vim-easy-align', { 'do': function('PlugUpdated') }
  529. Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
  530. call plug#end()
  531. call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
  532. call system('rm -rf '.g:plugs['vim-pseudocl'].dir)
  533. PlugUpdate
  534. Log getline(1, '$')
  535. q
  536. Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated2'),
  537. \ 'vim-easy-align/vim-easy-alignupdated2 should exist'
  538. Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled2'),
  539. \ 'vim-pseudocl/vim-pseudoclinstalled2 should exist'
  540. Execute (Cleanup):
  541. call system('rm -rf '.temp_plugged)
  542. call rename('fzf', 'fzf-staged')
  543. unlet g:plugs
  544. unlet g:plug_home
  545. unlet g:vimrc_reloaded
  546. unlet temp_plugged vader plug basertp save_rtp repo lnum fzf out
  547. delf PlugStatusSorted
  548. delf AssertExpect
  549. delf PlugUpdated
  550. delc AssertExpect
  551. unmap /
  552. unmap ?
  553. Restore