workflow.vader 17 KB

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