workflow.vader 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697
  1. Execute (plug#end() before plug#begin() should fail):
  2. redir => out
  3. silent! AssertEqual 0, plug#end()
  4. redir END
  5. Assert stridx(out, 'Call plug#begin() first') >= 0
  6. Execute (plug#begin() without path argument):
  7. call plug#begin()
  8. AssertEqual split(&rtp, ',')[0].'/plugged', g:plug_home
  9. unlet g:plug_home
  10. Execute (plug#begin() without path argument with empty &rtp):
  11. let save_rtp = &rtp
  12. set rtp=
  13. redir => out
  14. AssertEqual 0, plug#begin()
  15. redir END
  16. Assert stridx(out, 'Unable to determine plug home') >= 0
  17. let &rtp = save_rtp
  18. unlet save_rtp
  19. Execute (Standard runtime path is not allowed):
  20. redir => out
  21. silent! AssertEqual 0, plug#begin(split(&rtp, ',')[0].'/plugin')
  22. redir END
  23. Log out
  24. Assert stridx(out, 'Invalid plug home') >= 0
  25. Execute (plug#begin(path)):
  26. call plug#begin(g:temp_plugged.'/')
  27. Assert g:plug_home !~ '[/\\]$', 'Trailing / should be stripped from g:plug_home'
  28. AssertEqual 0, len(g:plugs)
  29. AssertEqual g:temp_plugged, g:plug_home
  30. AssertEqual g:base_rtp, &rtp
  31. Execute (Subsequent plug#begin() calls will reuse g:plug_home):
  32. call plug#begin()
  33. AssertEqual g:temp_plugged, g:plug_home
  34. Execute (Test Plug command):
  35. ^ Git repo with branch (DEPRECATED. USE BRANCH OPTION)
  36. Plug 'junegunn/seoul256.vim', { 'branch': 'yes-t_co' }
  37. AssertEqual 'file:///tmp/vim-plug-test/junegunn/seoul256.vim', g:plugs['seoul256.vim'].uri
  38. AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
  39. AssertEqual 'yes-t_co', g:plugs['seoul256.vim'].branch
  40. Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' } " Using branch option
  41. AssertEqual 'no-t_co', g:plugs['seoul256.vim'].branch
  42. ^ Git repo with tag (DEPRECATED. USE TAG OPTION)
  43. Plug 'junegunn/goyo.vim', '1.5.2'
  44. AssertEqual 'file:///tmp/vim-plug-test/junegunn/goyo.vim', g:plugs['goyo.vim'].uri
  45. AssertEqual join([g:temp_plugged, 'goyo.vim/'], '/'), g:plugs['goyo.vim'].dir
  46. AssertEqual '1.5.2', g:plugs['goyo.vim'].tag
  47. Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' } " Using tag option
  48. AssertEqual '1.5.3', g:plugs['goyo.vim'].tag
  49. " Git URI
  50. Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
  51. AssertEqual 'file:///tmp/vim-plug-test/jg/vim-emoji', g:plugs['vim-emoji'].uri
  52. AssertEqual 'master', g:plugs['vim-emoji'].branch
  53. AssertEqual join([g:temp_plugged, 'vim-emoji/'], '/'), g:plugs['vim-emoji'].dir
  54. " vim-scripts/
  55. Plug 'vim-scripts/beauty256'
  56. AssertEqual 'file:///tmp/vim-plug-test/vim-scripts/beauty256', g:plugs.beauty256.uri
  57. AssertEqual 'master', g:plugs.beauty256.branch
  58. AssertEqual 4, len(g:plugs)
  59. redir => out
  60. Plug 'beauty256'
  61. redir END
  62. Assert out =~ 'Invalid argument: beauty256'
  63. Execute (Plug command with dictionary option):
  64. Log string(g:plugs)
  65. Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
  66. AssertEqual join([g:temp_plugged, 'seoul256.vim/'], '/'), g:plugs['seoul256.vim'].dir
  67. AssertEqual '././', g:plugs['seoul256.vim'].rtp
  68. Log string(g:plugs)
  69. AssertEqual 4, len(g:plugs)
  70. Execute (PlugStatus before installation):
  71. PlugStatus
  72. AssertExpect 'Not found', 4
  73. q
  74. Execute (PlugClean before installation):
  75. PlugClean
  76. AssertExpect 'Already clean', 1
  77. q
  78. Execute (plug#end() updates &rtp):
  79. " Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
  80. " Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
  81. " Plug 'beauty256'
  82. " Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co', 'rtp': '././' }
  83. call plug#end()
  84. Assert len(&rtp) > len(g:base_rtp)
  85. AssertEqual g:first_rtp, split(&rtp, ',')[0]
  86. AssertEqual g:last_rtp, split(&rtp, ',')[-1]
  87. Execute (Yet, plugins are not available):
  88. Assert empty(globpath(&rtp, 'autoload/emoji.vim'))
  89. Execute (PlugInstall):
  90. PlugInstall
  91. q
  92. Execute (Plugin available after installation):
  93. Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
  94. Execute (PlugClean after installation):
  95. PlugClean
  96. AssertExpect 'Already clean', 1
  97. q
  98. Execute (PlugStatus after installation):
  99. PlugStatus
  100. Log getline(1, '$')
  101. AssertExpect 'OK', 4
  102. q
  103. Execute (PlugUpdate - tagged plugin should not fail (#174)):
  104. PlugUpdate goyo.vim
  105. Log getline(1, '$')
  106. AssertExpect '^- goyo.vim', 1
  107. q
  108. Execute (Change tag of goyo.vim):
  109. call plug#begin()
  110. Plug 'junegunn/goyo.vim', { 'tag': '9.9.9' }
  111. call plug#end()
  112. Execute (PlugStatus):
  113. call PlugStatusSorted()
  114. Expect:
  115. Invalid tag: 1.5.3 (expected: 9.9.9). Try PlugUpdate.
  116. Finished. 1 error(s).
  117. [=]
  118. x goyo.vim:
  119. Execute (Remove tag of goyo.vim):
  120. call plug#begin()
  121. Plug 'junegunn/goyo.vim'
  122. call plug#end()
  123. Execute (PlugStatus):
  124. call PlugStatusSorted()
  125. Expect:
  126. Invalid branch: HEAD (expected: master). Try PlugUpdate.
  127. Finished. 1 error(s).
  128. [=]
  129. x goyo.vim:
  130. Execute (PlugUpdate to set the right branch):
  131. PlugUpdate
  132. call PlugStatusSorted()
  133. Expect:
  134. - goyo.vim: OK
  135. Finished. 0 error(s).
  136. [=]
  137. Execute (Change branch of seoul256.vim):
  138. call plug#begin()
  139. Plug 'junegunn/seoul256.vim'
  140. Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
  141. call plug#end()
  142. Execute (PlugStatus):
  143. call PlugStatusSorted()
  144. Expect:
  145. Invalid branch: no-t_co (expected: master). Try PlugUpdate.
  146. - vim-emoji: OK
  147. Finished. 1 error(s).
  148. [==]
  149. x seoul256.vim:
  150. Execute (PlugUpdate to switch branch, then PlugStatus):
  151. PlugUpdate
  152. call PlugStatusSorted()
  153. Expect:
  154. - seoul256.vim: OK
  155. - vim-emoji: OK
  156. Finished. 0 error(s).
  157. [==]
  158. Execute (Change tag of seoul256.vim):
  159. call plug#begin()
  160. Plug 'junegunn/seoul256.vim', { 'tag': 'no-such-tag' }
  161. call plug#end()
  162. call PlugStatusSorted()
  163. Expect:
  164. Invalid tag: N/A (expected: no-such-tag). Try PlugUpdate.
  165. Finished. 1 error(s).
  166. [=]
  167. x seoul256.vim:
  168. Execute (Change URI of seoul256.vim):
  169. call plug#begin()
  170. Plug 'junegunn.choi/seoul256.vim'
  171. Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
  172. call plug#end()
  173. Execute (PlugStatus):
  174. call PlugStatusSorted()
  175. Expect:
  176. Expected: file:///tmp/vim-plug-test/junegunn.choi/seoul256.vim
  177. Invalid URI: file:///tmp/vim-plug-test/junegunn/seoul256.vim
  178. PlugClean required.
  179. - vim-emoji: OK
  180. Finished. 1 error(s).
  181. [==]
  182. x seoul256.vim:
  183. Execute (Corrected the URI but ahead of upstream):
  184. call plug#begin()
  185. Plug 'junegunn/seoul256.vim'
  186. Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
  187. call plug#end()
  188. for _ in range(3)
  189. call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['seoul256.vim'].dir))
  190. endfor
  191. call PlugStatusSorted()
  192. Expect:
  193. Ahead of origin/master by 3 commit(s).
  194. Cannot update until local changes are pushed.
  195. - vim-emoji: OK
  196. Finished. 1 error(s).
  197. [==]
  198. x seoul256.vim:
  199. # TODO: does not work due to inputsave()
  200. # Do (PlugClean):
  201. # :PlugClean\<Enter>y\<Enter>
  202. # ggyG
  203. # q
  204. # PGdd
  205. Execute (PlugClean! keeps seoul256.vim):
  206. PlugClean!
  207. " Two removed, emoji and seoul256 left
  208. AssertEqual 'Removed 2 directories.', getline(4)
  209. AssertExpect '^\~ ', 2
  210. AssertExpect 'Diverged', 0
  211. Assert !empty(globpath(&rtp, 'colors/seoul256.vim'))
  212. Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
  213. q
  214. Execute (Make seoul256 to be diverged):
  215. call plug#begin()
  216. Plug 'junegunn/seoul256.vim'
  217. Plug 'file:///tmp/vim-plug-test/jg/vim-emoji'
  218. call plug#end()
  219. call system(printf(join([
  220. \ 'cd "%s"',
  221. \ 'git fetch --unshallow',
  222. \ 'git reset "@{u}~1"',
  223. \ 'git commit --allow-empty -m "diverged1"',
  224. \ 'git commit --allow-empty -m "diverged2"'], ' && '),
  225. \ g:plugs['seoul256.vim'].dir))
  226. Assert empty(v:shell_error), 'Got shell error: '.v:shell_error
  227. call PlugStatusSorted()
  228. Expect:
  229. Backup local changes and run PlugClean and PlugUpdate to reinstall it.
  230. Diverged from origin/master (2 commit(s) ahead and 1 commit(s) behind!
  231. - vim-emoji: OK
  232. Finished. 1 error(s).
  233. [==]
  234. x seoul256.vim:
  235. Execute (PlugClean! removes seoul256.vim):
  236. PlugClean!
  237. " One removed, emoji left
  238. AssertEqual 'Removed 1 directories.', getline(4)
  239. AssertExpect '^\~ ', 1
  240. AssertExpect 'Diverged', 1
  241. Assert empty(globpath(&rtp, 'colors/seoul256.vim'))
  242. Assert !empty(globpath(&rtp, 'autoload/emoji.vim'))
  243. q
  244. Execute (Change GIT URI of vim-emoji):
  245. call plug#begin()
  246. Plug 'junegunn/seoul256.vim'
  247. Plug 'junegunn/vim-emoji'
  248. call plug#end()
  249. Execute (PlugStatus):
  250. call PlugStatusSorted()
  251. Expect:
  252. Expected: file:///tmp/vim-plug-test/junegunn/vim-emoji
  253. Invalid URI: file:///tmp/vim-plug-test/jg/vim-emoji
  254. Not found. Try PlugInstall.
  255. PlugClean required.
  256. Finished. 2 error(s).
  257. [==]
  258. x seoul256.vim:
  259. x vim-emoji:
  260. Execute (PlugClean! to remove vim-emoji):
  261. PlugClean!
  262. AssertExpect '^\~ ', 1
  263. AssertEqual 'Removed 1 directories.', getline(4)
  264. Assert empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim was removed'
  265. Assert empty(globpath(&rtp, 'autoload/emoji.vim')), 'emoji was removed'
  266. q
  267. Execute (PlugUpdate to install both again):
  268. PlugUpdate
  269. AssertExpect '^- [^:]*:', 2
  270. Assert !empty(globpath(&rtp, 'colors/seoul256.vim')), 'seoul256.vim should be found'
  271. Assert !empty(globpath(&rtp, 'autoload/emoji.vim')), 'vim-emoji should be found'
  272. q
  273. Execute (PlugUpdate only to find out plugins are up-to-date, D key to check):
  274. PlugUpdate
  275. AssertExpect 'Already up.to.date', 2, 'Expected 2 times "Already up-to-date", but got: '.string(getline(1, '$'))
  276. normal D
  277. AssertEqual '0 plugin(s) updated.', getline(1)
  278. q
  279. Execute (PlugDiff - 'No updates.'):
  280. PlugDiff
  281. Log getline(1, '$')
  282. AssertEqual '0 plugin(s) updated.', getline(1)
  283. Assert empty(mapcheck('o'))
  284. Assert empty(mapcheck('X'))
  285. Assert empty(mapcheck("\<cr>"))
  286. q
  287. Execute (New commits on remote, PlugUpdate, then PlugDiff):
  288. for repo in ['seoul256.vim', 'vim-emoji']
  289. for _ in range(2)
  290. call system(printf('cd /tmp/vim-plug-test/junegunn/%s && git commit --allow-empty -m "update"', repo))
  291. endfor
  292. endfor
  293. unlet repo
  294. PlugUpdate
  295. " Now we have updates
  296. normal D
  297. AssertEqual '2 plugin(s) updated.', getline(1)
  298. " Preview commit
  299. silent! wincmd P
  300. AssertEqual 0, &previewwindow
  301. " ]] motion
  302. execute 'normal ]]'
  303. let lnum = line('.')
  304. AssertEqual 3, col('.')
  305. " Open commit preview
  306. execute "normal j\<cr>"
  307. wincmd P
  308. AssertEqual 1, &previewwindow
  309. AssertEqual 'git', &filetype
  310. " Close preview window
  311. pclose
  312. " Open and go to preview window with a custom mapping
  313. nmap <buffer> <c-o> <plug>(plug-preview)<c-w>P
  314. execute "normal \<c-o>"
  315. AssertEqual 1, &previewwindow, 'Should be on preview window'
  316. normal q
  317. AssertEqual 0, &previewwindow, 'Should not be on preview window'
  318. " ]] motion
  319. execute 'normal $]]'
  320. Assert line('.') >= 4
  321. " 5+ for merge commit
  322. AssertEqual 3, col('.')
  323. " [[ motion
  324. execute 'normal 0[['
  325. AssertEqual lnum, line('.')
  326. unlet lnum
  327. AssertEqual 3, col('.')
  328. " X key to revert the update
  329. AssertExpect '^- ', 2
  330. execute "normal Xn\<cr>"
  331. AssertExpect '^- ', 2
  332. execute "normal Xy\<cr>"
  333. AssertExpect '^- ', 1
  334. " q will close preview window as well
  335. normal q
  336. " We no longer have preview window
  337. silent! wincmd P
  338. AssertEqual 0, &previewwindow
  339. " q should not close preview window if it's already open
  340. pedit
  341. PlugDiff
  342. AssertExpect '^- ', 1
  343. execute "normal ]]j\<cr>"
  344. normal q
  345. silent! wincmd P
  346. AssertEqual 1, &previewwindow
  347. pclose
  348. Execute (Test g:plug_pwindow):
  349. let g:plug_pwindow = 'below 5new'
  350. PlugDiff
  351. AssertExpect '^- ', 1
  352. execute "normal ]]jo"
  353. AssertEqual 0, &previewwindow
  354. AssertEqual 1, winnr()
  355. wincmd P
  356. AssertEqual 1, &previewwindow
  357. AssertEqual 2, winnr()
  358. AssertEqual 5, winheight('.')
  359. wincmd p
  360. normal q
  361. unlet g:plug_pwindow
  362. Execute (#572 - Commit preview should work with non-POSIX-compliant &shell):
  363. " Invalid shell
  364. let shell = &shell
  365. set shell=shellfish
  366. try
  367. " Preview commit should still work
  368. PlugDiff
  369. execute "normal ]]jo"
  370. wincmd P
  371. Log getline(1, '$')
  372. Assert getline(1) =~ 'commit', 'Preview window is empty'
  373. AssertEqual 'shellfish', &shell
  374. finally
  375. " Restore &shell
  376. let &shell = shell
  377. unlet shell
  378. pclose
  379. q
  380. endtry
  381. Execute (Reuse Plug window in another tab):
  382. let tabnr = tabpagenr()
  383. PlugDiff
  384. tab new new-tab
  385. set buftype=nofile
  386. PlugUpdate
  387. normal D
  388. AssertExpect '^- ', 1
  389. normal q
  390. AssertEqual tabnr, tabpagenr()
  391. normal! gt
  392. q
  393. unlet tabnr
  394. Execute (contd. PlugDiff should not show inverted history):
  395. " Additional PlugUpdate to clear diff
  396. PlugUpdate
  397. PlugDiff
  398. Log getline(1, '$')
  399. " Checking out older revisions
  400. for repo in values(g:plugs)
  401. call system(printf('cd %s && git reset HEAD^ --hard', shellescape(repo.dir)))
  402. endfor
  403. unlet repo
  404. " PlugDiff should not report the changes i.e. git log --left-only
  405. PlugDiff
  406. Log getline(1, '$')
  407. AssertEqual '0 plugin(s) updated.', getline(1)
  408. q
  409. **********************************************************************
  410. ~ PlugDiff to see the pending changes
  411. **********************************************************************
  412. Execute (PlugDiff):
  413. call plug#begin()
  414. call plug#end()
  415. PlugClean!
  416. call plug#begin()
  417. Plug 'file://'.expand('$PLUG_FIXTURES').'/xxx'
  418. Plug 'file://'.expand('$PLUG_FIXTURES').'/yyy'
  419. call plug#end()
  420. PlugInstall
  421. Log getline(1, '$')
  422. call system('cd "$PLUG_FIXTURES/xxx" && git commit --allow-empty -m update-xxx && git tag -f xxx')
  423. call system('cd "$PLUG_FIXTURES/yyy" && git tag -f yyy && git commit --allow-empty -m update-yyy && git tag -f zzz')
  424. let g:plugs.yyy.tag = 'yyy'
  425. PlugUpdate
  426. Log getline(1, '$')
  427. PlugDiff
  428. " 1 plugin(s) updated. 1 plugin(s) have pending updates.
  429. " [==]
  430. "
  431. " Last update:
  432. " ------------
  433. "
  434. " - xxx:
  435. " 166cfff (tag: xxx) update-xxx (1 second ago)
  436. "
  437. " Pending updates:
  438. " ----------------
  439. "
  440. " - yyy: (tag: yyy)
  441. " c0a064b (tag: zzz) update-yyy (1 second ago)
  442. "
  443. Log getline(1, '$')
  444. AssertEqual 15, line('$')
  445. AssertEqual '1 plugin(s) updated. 1 plugin(s) have pending updates.', getline(1)
  446. AssertEqual '[==]', getline(2)
  447. AssertEqual '- yyy: (tag: yyy)', getline(13)
  448. Assert getline(8) =~ '(tag: xxx)'
  449. Assert getline(14) =~ '(tag: zzz)'
  450. Assert !empty(mapcheck('o'))
  451. Assert !empty(mapcheck('X'))
  452. Assert !empty(mapcheck("\<cr>"))
  453. q
  454. Execute (Do not show diff for commits outside of rtp):
  455. call plug#begin()
  456. call plug#end()
  457. PlugClean!
  458. call plug#begin()
  459. Plug 'file://'.expand('$PLUG_FIXTURES').'/xxx'
  460. Plug 'file://'.expand('$PLUG_FIXTURES').'/yyy', { 'rtp': 'rtp' }
  461. call plug#end()
  462. PlugInstall
  463. Log getline(1, '$')
  464. call system('cd "$PLUG_FIXTURES/xxx" && git commit --allow-empty -m update-xxx && git tag -f xxx')
  465. call system('cd "$PLUG_FIXTURES/yyy" && git commit --allow-empty -m update-yyy && git tag -f yyy')
  466. let g:plugs.yyy.tag = 'yyy'
  467. PlugUpdate
  468. Log getline(1, '$')
  469. PlugDiff
  470. " 1 plugin(s) updated.
  471. " [==]
  472. "
  473. " Last update:
  474. " ------------
  475. "
  476. " - xxx:
  477. " * 7faa9b2 update-xxx (0 seconds ago)
  478. "
  479. " Pending updates:
  480. " ----------------
  481. "
  482. " N/A
  483. "
  484. Log getline(1, '$')
  485. AssertEqual 14, line('$')
  486. AssertEqual '1 plugin(s) updated.', getline(1)
  487. AssertEqual '[==]', getline(2)
  488. AssertEqual 'Last update:', getline(4)
  489. AssertEqual '- xxx:', getline(7)
  490. Assert !empty(mapcheck('o'))
  491. Assert !empty(mapcheck('X'))
  492. Assert !empty(mapcheck("\<cr>"))
  493. q
  494. **********************************************************************
  495. ~ On-demand loading / Partial installation/update ~
  496. **********************************************************************
  497. Execute (Trying to execute on-demand commands when plugin is not installed):
  498. call ReloadPlug()
  499. call plug#begin()
  500. Plug 'junegunn/vim-easy-align', { 'on': ['EasyAlign', 'LiveEasyAlign!'] }
  501. call plug#end()
  502. Assert exists(':EasyAlign')
  503. Assert exists(':LiveEasyAlign')
  504. AssertThrows EasyAlign
  505. AssertThrows LiveEasyAlign
  506. Assert !exists(':EasyAlign')
  507. Assert !exists(':LiveEasyAlign')
  508. Execute (New set of plugins):
  509. call ReloadPlug()
  510. call plug#begin()
  511. Plug 'junegunn/vim-fnr'
  512. Plug 'junegunn/vim-pseudocl'
  513. Plug 'junegunn/vim-easy-align', { 'on': 'EasyAlign' }
  514. Plug 'junegunn/vim-redis', { 'for': 'redis' }
  515. let user_autocmd = {}
  516. autocmd! User vim-fnr let user_autocmd.fnr = 1
  517. autocmd! User vim-easy-align let user_autocmd.easy_align = 1
  518. autocmd! User vim-redis let user_autocmd.redis = 1
  519. call plug#end()
  520. Execute (Check commands):
  521. Assert !exists(':FNR'), 'FNR command should not be found'
  522. Assert !exists(':RedisExecute'), 'RedisExecute command should not be found'
  523. Assert empty(user_autocmd)
  524. Execute (Partial PlugInstall):
  525. PlugInstall vim-fnr vim-easy-align
  526. AssertExpect 'vim-fnr', 1
  527. q
  528. PlugInstall vim-fnr vim-easy-align 1
  529. AssertExpect 'vim-fnr', 1
  530. AssertExpect 'vim-easy-align', 1
  531. AssertEqual g:first_rtp, split(&rtp, ',')[0]
  532. AssertEqual g:last_rtp, split(&rtp, ',')[-1]
  533. q
  534. Given (Unaligned code):
  535. a=1
  536. aa=2
  537. Execute (Check installed plugins):
  538. call EnsureLoaded()
  539. Assert exists(':FNR'), 'FNR command should be found'
  540. Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
  541. Assert exists(':EasyAlign'), 'EasyAlign command should be found'
  542. %EasyAlign=
  543. Expect (Aligned code):
  544. a = 1
  545. aa = 2
  546. Then (autocmd executed):
  547. Assert user_autocmd.easy_align
  548. AssertEqual 1, len(user_autocmd)
  549. Given:
  550. Execute (Partial PlugUpdate):
  551. PlugUpdate vim-redis
  552. q
  553. Execute (On-demand loading based on filetypes):
  554. Assert !exists(':RedisExecute'), 'RedisExecute command still should not be found'
  555. set ft=redis
  556. Assert exists(':RedisExecute'), 'RedisExecute command is now found'
  557. Assert user_autocmd.redis
  558. AssertEqual 2, len(user_autocmd)
  559. autocmd! User
  560. unlet user_autocmd
  561. **********************************************************************
  562. ~ Local (unmanaged) plugins
  563. **********************************************************************
  564. Execute (Add unmanaged plugin):
  565. let fzf = expand('$PLUG_FIXTURES/fzf')
  566. call RmRf(fzf)
  567. Log fzf
  568. call plug#begin()
  569. Plug fzf, { 'on': 'SomeCommand' }
  570. call plug#end()
  571. " Check uri field
  572. Assert !has_key(g:plugs.fzf, 'uri'), 'Should not have uri field'
  573. " Check dir field
  574. AssertEqual fzf.'/', g:plugs.fzf.dir
  575. " Trailing slashes and backslashes should be stripped
  576. for suffix in ['///', '/\/\/']
  577. call plug#begin()
  578. Plug fzf.suffix, { 'on': 'SomeCommand' }
  579. call plug#end()
  580. " Check dir field
  581. AssertEqual fzf.'/', g:plugs.fzf.dir
  582. endfor
  583. Execute (Plug block for following tests):
  584. call plug#begin()
  585. Plug 'junegunn/vim-easy-align'
  586. Plug fzf, { 'on': 'SomeCommand' }
  587. call plug#end()
  588. " Remove plugins from previous tests
  589. PlugClean!
  590. q
  591. Execute (PlugInstall will only install vim-easy-align):
  592. PlugInstall
  593. Log getline(1, '$')
  594. AssertExpect 'fzf', 0
  595. q
  596. Execute (PlugUpdate will only update vim-easy-align):
  597. PlugUpdate
  598. Log getline(1, '$')
  599. AssertExpect 'fzf', 0
  600. q
  601. Execute (PlugClean should not care about unmanaged plugins):
  602. PlugClean
  603. Log getline(1, '$')
  604. AssertExpect 'fzf', 0
  605. q
  606. Execute (PlugStatus should point out that the plugin is missing):
  607. PlugStatus
  608. Log getline(1, '$')
  609. AssertExpect 'x fzf', 1
  610. AssertExpect 'Not found', 1
  611. q
  612. Execute (Deploy unmanaged plugin):
  613. Assert !exists(':FZF'), ':FZF command should not exist'
  614. call RmRf(fzf)
  615. Log system(printf('cp -r "/tmp/vim-plug-test/fzf" "%s"', fzf))
  616. Execute (PlugUpdate still should not care):
  617. PlugUpdate
  618. Log getline(1, '$')
  619. AssertExpect 'fzf', 0
  620. q
  621. Execute (PlugStatus with no error):
  622. PlugStatus
  623. Log getline(1, '$')
  624. AssertExpect 'x fzf', 0
  625. AssertExpect 'Not found', 0
  626. q
  627. Execute (Check &rtp after SomeCommand):
  628. Log &rtp
  629. Assert &rtp !~ 'fzf'
  630. silent! SomeCommand
  631. Assert &rtp =~ 'fzf'
  632. AssertEqual g:first_rtp, split(&rtp, ',')[0]
  633. AssertEqual g:last_rtp, split(&rtp, ',')[-1]
  634. Execute (Common parent):
  635. call plug#begin()
  636. Plug 'junegunn/vim-pseudocl'
  637. Plug 'junegunn/vim-fnr'
  638. Plug 'junegunn/vim-oblique'
  639. call plug#end()
  640. PlugInstall
  641. Log getline(1, '$')
  642. AssertExpect! '[===]', 1
  643. q
  644. unlet fzf
  645. **********************************************************************
  646. ~ Frozen plugins
  647. **********************************************************************
  648. - We've decided to install plugins that are frozen: see #113
  649. Execute (Frozen plugin are not ~~installed nor~~ updated):
  650. " Remove plugins
  651. call plug#begin()
  652. call plug#end()
  653. PlugClean!
  654. q
  655. " vim-easy-align is not found, so it will be installed even though it's frozen
  656. call plug#begin()
  657. Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
  658. call plug#end()
  659. PlugInstall
  660. AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
  661. q
  662. " Remove plugins again
  663. call plug#begin()
  664. call plug#end()
  665. PlugClean!
  666. q
  667. " PlugUpdate will do the same
  668. call plug#begin()
  669. Plug 'junegunn/vim-easy-align', { 'frozen': 1 }
  670. call plug#end()
  671. PlugInstall
  672. AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
  673. q
  674. " Since vim-easy-align already exists, PlugInstall or PlugUpdate will skip it
  675. redir => out
  676. silent PlugInstall
  677. redir END
  678. Assert out =~ 'No plugin to install'
  679. redir => out
  680. silent PlugUpdate
  681. redir END
  682. Assert out =~ 'No plugin to update'
  683. Execute (But you can still install it if the name is given as the argument):
  684. PlugInstall vim-easy-align
  685. Log getline(1, '$')
  686. AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
  687. q
  688. PlugUpdate vim-easy-align
  689. Log getline(1, '$')
  690. AssertEqual 1, len(filter(getline(1, '$'), 'v:val =~ "vim-easy-align"'))
  691. q
  692. **********************************************************************
  693. ~ Retry
  694. **********************************************************************
  695. Execute (Retry failed tasks):
  696. call plug#begin()
  697. Plug 'junegunn/vim-easy-align'
  698. Plug 'junegunn/aaaaaaaaaaaaaa'
  699. call plug#end()
  700. PlugInstall
  701. Log getline(1, '$')
  702. AssertExpect 'x aaa', 1
  703. AssertExpect '- vim-easy-align', 1
  704. normal R
  705. Log getline(1, '$')
  706. AssertExpect 'x aaa', 1
  707. AssertExpect '- vim-easy-align', 0
  708. AssertExpect! '[x]', 1
  709. q
  710. call plug#begin()
  711. Plug 'junegunn/vim-easy-align'
  712. Plug 'junegunn/aaaaaaaaaaaaaa'
  713. Plug 'junegunn/bbbbbbbbbbbbbb'
  714. Plug 'junegunn/cccccccccccccc'
  715. call plug#end()
  716. " Ruby installer
  717. PlugUpdate
  718. normal R
  719. AssertExpect '- vim-easy-align', 0
  720. AssertExpect! '[xxx]', 1
  721. q
  722. " Vim installer
  723. PlugUpdate 1
  724. normal R
  725. AssertExpect '- vim-easy-align', 0
  726. AssertExpect! '[xxx]', 1
  727. q
  728. **********************************************************************
  729. ~ Post-update hook (`do` option)
  730. **********************************************************************
  731. Execute (Cleanup):
  732. call plug#begin()
  733. call plug#end()
  734. PlugClean!
  735. q
  736. Execute (On install):
  737. call plug#begin()
  738. Plug 'junegunn/vim-easy-align', { 'do': 'touch installed' }
  739. Plug 'junegunn/vim-pseudocl'
  740. Plug 'junegunn/seoul256.vim'
  741. Plug 'junegunn/goyo.vim'
  742. Plug 'yous/subsubmodule'
  743. call plug#end()
  744. silent PlugInstall
  745. q
  746. Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed'),
  747. \ 'vim-easy-align/installed should exist'
  748. Assert !filereadable(g:plugs['vim-pseudocl'].dir.'/installed'),
  749. \ 'vim-pseudocl/installed should not exist'
  750. AssertEqual ' ', system('cd '.g:plugs['subsubmodule'].dir.' && git submodule status')[0],
  751. \ 'subsubmodule/subsubmodule should be initialized'
  752. Execute (On update):
  753. call plug#begin()
  754. Plug 'junegunn/vim-easy-align', { 'do': 'touch updated' }
  755. Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
  756. Plug 'junegunn/seoul256.vim'
  757. Plug 'junegunn/goyo.vim'
  758. Plug 'yous/subsubmodule'
  759. call plug#end()
  760. " New commits on remote
  761. call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
  762. silent PlugUpdate
  763. Log getline(1, '$')
  764. q
  765. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated'),
  766. \ 'vim-easy-align/updated should not exist'
  767. Assert filereadable(g:plugs['vim-pseudocl'].dir.'/updated'),
  768. \ 'vim-pseudocl/updated should exist'
  769. Execute (When already installed):
  770. call plug#begin()
  771. Plug 'junegunn/vim-easy-align', { 'do': 'touch installed2' }
  772. Plug 'junegunn/vim-pseudocl', { 'commit': '7f8cd78' }
  773. Plug 'junegunn/seoul256.vim', { 'branch': 'no-t_co' }
  774. Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
  775. Plug 'yous/subsubmodule'
  776. call plug#end()
  777. PlugInstall
  778. q
  779. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
  780. \ 'vim-easy-align/installed2 should not exist'
  781. AssertNotEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
  782. AssertNotEqual 'no-t_co', GitBranch('seoul256.vim')
  783. AssertNotEqual '1.5.3', GitTag('goyo.vim')
  784. Execute (PlugInstall!):
  785. silent PlugInstall!
  786. q
  787. Assert filereadable(g:plugs['vim-easy-align'].dir.'/installed2'),
  788. \ 'vim-easy-align/installed2 should exist'
  789. AssertEqual '7f8cd78cb1fe52185b98b16a3749811f0cc508af', GitCommit('vim-pseudocl')
  790. AssertEqual 'no-t_co', GitBranch('seoul256.vim')
  791. AssertEqual '1.5.3', GitTag('goyo.vim')
  792. Execute (When submodules are not initialized):
  793. call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
  794. silent PlugInstall!
  795. q
  796. AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
  797. \ 'subsubmodule/subsubmodule should be initialized'
  798. Execute (When already updated):
  799. call plug#begin()
  800. Plug 'junegunn/vim-easy-align', { 'do': 'touch updated2' }
  801. Plug 'junegunn/vim-pseudocl', { 'commit': 'dd507ca' }
  802. Plug 'junegunn/seoul256.vim', { 'branch': 'master' }
  803. Plug 'junegunn/goyo.vim', { 'tag': '1.6.0' }
  804. Plug 'yous/subsubmodule'
  805. call plug#end()
  806. PlugUpdate
  807. q
  808. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
  809. \ 'vim-easy-align/updated2 should not exist'
  810. AssertEqual 'dd507ca0d5f3fdf0d522558cc5ecffdabf824469', GitCommit('vim-pseudocl')
  811. AssertEqual 'master', GitBranch('seoul256.vim')
  812. AssertEqual '1.6.0', GitTag('goyo.vim')
  813. Execute (PlugUpdate!):
  814. silent PlugUpdate!
  815. q
  816. Assert filereadable(g:plugs['vim-easy-align'].dir.'/updated2'),
  817. \ 'vim-easy-align/updated2 should exist'
  818. Execute (When submodules are not initialized):
  819. call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
  820. ^ #481 submodule update should use standard shell
  821. let sh = &shell
  822. set sh=/bin/echo
  823. silent PlugUpdate!
  824. let &shell = sh
  825. unlet sh
  826. q
  827. AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
  828. \ 'subsubmodule/subsubmodule should be initialized'
  829. Execute (Using Funcref):
  830. function! PlugUpdated(info)
  831. call system('touch '. a:info.name . a:info.status . a:info.force . len(a:info))
  832. endfunction
  833. call plug#begin()
  834. Plug 'junegunn/vim-easy-align', { 'do': function('PlugUpdated') }
  835. Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
  836. call plug#end()
  837. call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
  838. call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
  839. call RmRf(g:plugs['vim-pseudocl'].dir)
  840. PlugUpdate
  841. Log getline(1, '$')
  842. q
  843. Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated03'),
  844. \ 'vim-easy-align/vim-easy-alignupdated03 should exist'
  845. Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled03'),
  846. \ 'vim-pseudocl/vim-pseudoclinstalled03 should exist'
  847. call RmRf(g:plugs['vim-pseudocl'].dir)
  848. PlugInstall!
  849. q
  850. Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignunchanged13'),
  851. \ 'vim-easy-align/vim-easy-alignunchanged13 should exist'
  852. Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclinstalled13'),
  853. \ 'vim-pseudocl/vim-pseudoclinstalled13 should exist'
  854. call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
  855. PlugUpdate!
  856. q
  857. Assert filereadable(g:plugs['vim-easy-align'].dir.'/vim-easy-alignupdated13'),
  858. \ 'vim-easy-align/vim-easy-alignupdated13 should exist'
  859. Assert filereadable(g:plugs['vim-pseudocl'].dir.'/vim-pseudoclunchanged13'),
  860. \ 'vim-pseudocl/vim-pseudoclunchanged13 should exist'
  861. Execute (Post-update hook output; success and failure):
  862. call plug#begin()
  863. Plug 'junegunn/vim-easy-align', { 'do': 'xxx-non-existent-command-xxx' }
  864. Plug 'junegunn/vim-pseudocl', { 'do': 'true' }
  865. call plug#end()
  866. silent PlugInstall! 1
  867. AssertEqual '- Post-update hook for vim-pseudocl ... OK', getline(5)
  868. AssertEqual 'x Post-update hook for vim-easy-align ... Exit status: 127', getline(6)
  869. q
  870. Execute (Post-update hook output; invalid type or funcref):
  871. call plug#begin()
  872. Plug 'junegunn/vim-easy-align', { 'do': 1 }
  873. Plug 'junegunn/vim-pseudocl', { 'do': function('call') }
  874. call plug#end()
  875. silent PlugInstall! 1
  876. AssertEqual 'x Post-update hook for vim-pseudocl ... Vim(call):E119: Not enough arguments for function: call', getline(5)
  877. AssertEqual 'x Post-update hook for vim-easy-align ... Invalid hook type', getline(6)
  878. q
  879. Execute (Should not run when failed to update):
  880. call plug#begin()
  881. Plug 'junegunn/vim-easy-align', { 'do': 'touch failed' }
  882. Plug 'junegunn/vim-pseudocl', { 'do': 'touch not-failed' }
  883. call plug#end()
  884. " Invalid remote URL
  885. call system(printf('cd %s && git remote set-url origin xxx', g:plugs['vim-easy-align'].dir))
  886. " New commits on remote
  887. call system('cd /tmp/vim-plug-test/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
  888. call system('cd /tmp/vim-plug-test/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
  889. silent PlugUpdate
  890. Log getline(1, '$')
  891. q
  892. Assert !filereadable(g:plugs['vim-easy-align'].dir.'/failed'),
  893. \ 'vim-easy-align/failed should not exist'
  894. Assert filereadable(g:plugs['vim-pseudocl'].dir.'/not-failed'),
  895. \ 'vim-pseudocl/not-failed should exist'
  896. Execute (Vim command with : prefix):
  897. call plug#begin()
  898. Plug 'junegunn/vim-pseudocl', { 'do': ':call setline(2, 12345)' }
  899. call plug#end()
  900. PlugInstall!
  901. Log getline(1, '$')
  902. AssertEqual '12345', getline(2)
  903. q
  904. Execute (Vim command with : prefix closing the window):
  905. call plug#begin()
  906. Plug 'junegunn/vim-pseudocl', { 'do': ':close' }
  907. call plug#end()
  908. redir => out
  909. PlugInstall!
  910. redir END
  911. Assert out =~ 'vim-plug was terminated'
  912. Assert out =~ 'of vim-pseudocl'
  913. Execute (Invalid vim command in post-update hook):
  914. call plug#begin()
  915. Plug 'junegunn/vim-pseudocl', { 'do': ':nosuchcommand' }
  916. call plug#end()
  917. PlugInstall!
  918. Log getline(1, '$')
  919. AssertExpect! 'x Post-update hook for vim-pseudocl ... Vim:E492: Not an editor command: nosuchcommand', 1
  920. q
  921. **********************************************************************
  922. ~ Overriding `dir`
  923. **********************************************************************
  924. Execute (Using custom dir):
  925. call plug#begin()
  926. Plug 'junegunn/vim-easy-align'
  927. call plug#end()
  928. Assert isdirectory(g:plugs['vim-easy-align'].dir)
  929. call RmRf('/tmp/vim-plug-test/easy-align')
  930. call plug#begin()
  931. Plug 'junegunn/vim-easy-align', { 'dir': '/tmp/vim-plug-test/easy-align' }
  932. call plug#end()
  933. AssertEqual '/tmp/vim-plug-test/easy-align/', g:plugs['vim-easy-align'].dir
  934. PlugClean!
  935. Assert !isdirectory(g:plugs['vim-easy-align'].dir)
  936. q
  937. PlugInstall
  938. q
  939. Assert isdirectory(g:plugs['vim-easy-align'].dir)
  940. **********************************************************************
  941. ~ On-demand loading load order
  942. **********************************************************************
  943. Before (Clear global vars):
  944. let g:xxx = []
  945. set rtp-=$PLUG_FIXTURES/xxx/
  946. set rtp-=$PLUG_FIXTURES/xxx/after
  947. Execute (Immediate loading):
  948. call ReloadPlug()
  949. call plug#begin()
  950. Plug '$PLUG_FIXTURES/xxx'
  951. call plug#end()
  952. " FIXME:
  953. " Different result when Vader is run from commandline with `-c` option
  954. Log g:xxx
  955. if has('vim_starting')
  956. AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
  957. else
  958. AssertEqual ['xxx/plugin', 'xxx/after/plugin', 'xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
  959. endif
  960. Execute (Command-based on-demand loading):
  961. call ReloadPlug()
  962. call plug#begin()
  963. Plug '$PLUG_FIXTURES/xxx', { 'on': 'XXX' }
  964. call plug#end()
  965. AssertEqual [], g:xxx
  966. silent! XXX
  967. AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin'], g:xxx
  968. setf xxx
  969. AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
  970. Execute (Filetype-based on-demand loading):
  971. call ReloadPlug()
  972. call plug#begin()
  973. Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
  974. Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
  975. call plug#end()
  976. AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
  977. setf xxx
  978. AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent'], g:xxx
  979. " syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
  980. setf yyy
  981. AssertEqual ['yyy/ftdetect', 'yyy/after/ftdetect', 'yyy/plugin', 'yyy/after/plugin'], g:yyy
  982. Before:
  983. **********************************************************************
  984. ~ plug#helptags()
  985. **********************************************************************
  986. Execute (plug#helptags):
  987. call plug#begin()
  988. Plug '$PLUG_FIXTURES/xxx'
  989. Plug '$PLUG_FIXTURES/yyy', { 'rtp': 'rtp' }
  990. call plug#end()
  991. silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
  992. silent! call delete(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
  993. Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
  994. Assert !filereadable(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
  995. AssertEqual 1, plug#helptags()
  996. Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
  997. Assert filereadable(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
  998. **********************************************************************
  999. ~ Manual loading
  1000. **********************************************************************
  1001. Execute (plug#load - invalid arguments):
  1002. call ResetPlug()
  1003. call plug#begin()
  1004. Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
  1005. Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
  1006. call plug#end()
  1007. AssertEqual 0, plug#load()
  1008. AssertEqual 0, plug#load('non-existent-plugin')
  1009. AssertEqual 0, plug#load('non-existent-plugin', 'another-non-existent-plugin')
  1010. AssertEqual 1, plug#load('xxx')
  1011. AssertEqual 0, plug#load('xxx', 'non-existent-plugin')
  1012. AssertEqual 0, plug#load('non-existent-plugin', 'xxx')
  1013. Execute (plug#load - list argument (#638)):
  1014. redir => out
  1015. call plug#load(keys(g:plugs))
  1016. redir END
  1017. AssertEqual '', out
  1018. Execute (on: []):
  1019. call plug#begin()
  1020. Plug 'junegunn/rust.vim', { 'on': [] }
  1021. call plug#end()
  1022. PlugInstall
  1023. q
  1024. Execute (PlugStatus reports (not loaded)):
  1025. PlugStatus
  1026. AssertExpect 'not loaded', 1
  1027. q
  1028. Execute (plug#load to load it):
  1029. tabnew test.rs
  1030. " Vader will switch tab to [Vader-workbench] after Log
  1031. " Log &filetype
  1032. AssertEqual 1, plug#load('rust.vim')
  1033. AssertEqual 'rust', &filetype
  1034. q
  1035. Execute (PlugStatus should not contain (not loaded)):
  1036. PlugStatus
  1037. AssertExpect 'not loaded', 0
  1038. q
  1039. Execute (Load plugin from PlugStatus screen with L key in normal mode):
  1040. call ResetPlug()
  1041. unlet! g:yyy
  1042. call plug#begin()
  1043. Plug '$PLUG_FIXTURES/yyy', { 'on': [] }
  1044. call plug#end()
  1045. PlugStatus
  1046. AssertExpect 'not loaded', 1
  1047. Assert !exists('g:yyy'), 'yyy not loaded'
  1048. /not loaded
  1049. normal L
  1050. AssertExpect 'not loaded', 0
  1051. Assert exists('g:yyy'), 'yyy loaded'
  1052. q
  1053. Execute (Load plugin from PlugStatus screen with L key in visual mode):
  1054. call plug#begin()
  1055. Plug '$PLUG_FIXTURES/z1', { 'on': [] }
  1056. Plug '$PLUG_FIXTURES/z2', { 'for': [] }
  1057. call plug#end()
  1058. PlugStatus
  1059. AssertExpect 'not loaded', 2
  1060. Assert !exists('g:z1'), 'z1 not loaded'
  1061. Assert !exists('g:z2'), 'z2 not loaded'
  1062. normal ggVGL
  1063. AssertExpect 'not loaded', 0
  1064. Assert exists('g:z1'), 'z1 loaded'
  1065. Assert exists('g:z2'), 'z2 loaded'
  1066. q
  1067. **********************************************************************
  1068. ~ g:plug_window
  1069. **********************************************************************
  1070. Execute (Open plug window in a new tab):
  1071. " Without g:plug_window, plug window is open on the left split
  1072. let tabnr = tabpagenr()
  1073. PlugStatus
  1074. AssertEqual tabnr, tabpagenr()
  1075. AssertEqual 1, winnr()
  1076. " PlugStatus again inside the window should not change the view
  1077. normal S
  1078. AssertEqual tabnr, tabpagenr()
  1079. AssertEqual 1, winnr()
  1080. q
  1081. " Define g:plug_window so that plug window is open in a new tab
  1082. let g:plug_window = 'tabnew'
  1083. PlugStatus
  1084. AssertNotEqual tabnr, tabpagenr()
  1085. " PlugStatus again inside the window should not change the view
  1086. let tabnr = tabpagenr()
  1087. normal S
  1088. AssertEqual tabnr, tabpagenr()
  1089. q
  1090. unlet g:plug_window tabnr
  1091. **********************************************************************
  1092. ~ g:plug_url_format
  1093. **********************************************************************
  1094. Execute (Using g:plug_url_format):
  1095. let prev_plug_url_format = g:plug_url_format
  1096. call plug#begin()
  1097. let g:plug_url_format = 'git@bitbucket.org:%s.git'
  1098. Plug 'junegunn/seoul256.vim'
  1099. let g:plug_url_format = 'git@bitsocket.org:%s.git'
  1100. Plug 'vim-scripts/beauty256'
  1101. AssertEqual 'git@bitbucket.org:junegunn/seoul256.vim.git', g:plugs['seoul256.vim'].uri
  1102. AssertEqual 'git@bitsocket.org:vim-scripts/beauty256.git', g:plugs['beauty256'].uri
  1103. let g:plug_url_format = prev_plug_url_format
  1104. **********************************************************************
  1105. ~ U
  1106. **********************************************************************
  1107. Execute (Plug block):
  1108. call plug#begin()
  1109. Plug 'junegunn/vim-easy-align'
  1110. Plug 'junegunn/vim-emoji'
  1111. call plug#end()
  1112. Execute (Update plugin with U key in normal mode):
  1113. PlugStatus
  1114. /emoji
  1115. normal U
  1116. Log getline(1, '$')
  1117. AssertExpect 'Updated', 1
  1118. AssertExpect 'vim-emoji', 1
  1119. AssertExpect 'vim-easy-align', 0
  1120. AssertExpect! '[=]', 1
  1121. " From PlugInstall screen
  1122. PlugInstall
  1123. /easy-align
  1124. normal U
  1125. AssertExpect 'Updated', 1
  1126. AssertExpect 'vim-emoji', 0
  1127. AssertExpect 'vim-easy-align', 1
  1128. AssertExpect! '[=]', 1
  1129. q
  1130. Execute (Update plugins with U key in visual mode):
  1131. silent! call RmRf(g:plugs['vim-easy-align'].dir)
  1132. PlugStatus
  1133. normal VGU
  1134. Log getline(1, '$')
  1135. AssertExpect 'Updated', 1
  1136. AssertExpect 'vim-emoji', 1
  1137. AssertExpect 'vim-easy-align', 1
  1138. AssertExpect! '[==]', 1
  1139. " From PlugUpdate screen
  1140. normal VGU
  1141. Log getline(1, '$')
  1142. AssertExpect 'Updated', 1
  1143. AssertExpect 'vim-emoji', 1
  1144. AssertExpect 'vim-easy-align', 1
  1145. AssertExpect! '[==]', 1
  1146. q
  1147. **********************************************************************
  1148. Execute (plug#begin should expand env vars):
  1149. AssertNotEqual '$HOME/.emacs/plugged', expand('$HOME/.emacs/plugged')
  1150. call plug#begin('$HOME/.emacs/plugged')
  1151. AssertEqual expand('$HOME/.emacs/plugged'), g:plug_home
  1152. **********************************************************************
  1153. Execute (Plug directory with comma):
  1154. call plug#begin(g:temp_plugged . '/p,l,u,g,g,e,d')
  1155. Plug 'junegunn/vim-emoji'
  1156. call plug#end()
  1157. Log &rtp
  1158. PlugInstall
  1159. q
  1160. let found = filter(split(globpath(&rtp, 'README.md'), '\n'), 'v:val =~ ","')
  1161. Log found
  1162. AssertEqual 1, len(found)
  1163. unlet found
  1164. **********************************************************************
  1165. Execute (Strict load order):
  1166. let g:total_order = []
  1167. call ReloadPlug()
  1168. call plug#begin()
  1169. Plug '$PLUG_FIXTURES/xxx'
  1170. Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
  1171. call plug#end()
  1172. call EnsureLoaded()
  1173. setf xxx
  1174. Log 'Case 1: ' . &rtp
  1175. AssertEqual ['yyy/ftdetect', 'yyy/after/ftdetect', 'xxx/ftdetect', 'xxx/after/ftdetect'], g:total_order[0:3]
  1176. Assert index(g:total_order, 'xxx/plugin') < index(g:total_order, 'yyy/plugin')
  1177. Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
  1178. let len = len(split(&rtp, ','))
  1179. let g:total_order = []
  1180. call ReloadPlug()
  1181. call plug#begin()
  1182. Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
  1183. Plug '$PLUG_FIXTURES/yyy'
  1184. call plug#end()
  1185. call EnsureLoaded()
  1186. set rtp^=manually-prepended
  1187. set rtp+=manually-appended
  1188. setf xxx
  1189. Log 'Case 2: ' . &rtp
  1190. AssertEqual 'manually-prepended', split(&rtp, ',')[3]
  1191. AssertEqual 'manually-appended', split(&rtp, ',')[-4]
  1192. AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'yyy/ftdetect', 'yyy/after/ftdetect'], g:total_order[0:3]
  1193. Assert index(g:total_order, 'yyy/plugin') < index(g:total_order, 'xxx/plugin')
  1194. Assert index(g:total_order, 'yyy/after/plugin') < index(g:total_order, 'xxx/after/plugin')
  1195. AssertEqual len + 2, len(split(&rtp, ','))
  1196. let g:total_order = []
  1197. call ReloadPlug()
  1198. set rtp^=manually-prepended
  1199. set rtp+=manually-appended
  1200. call plug#begin()
  1201. Plug '$PLUG_FIXTURES/xxx', { 'for': ['xxx'] }
  1202. Plug '$PLUG_FIXTURES/yyy', { 'for': ['xxx'] }
  1203. call plug#end()
  1204. call EnsureLoaded()
  1205. setf xxx
  1206. Log 'Case 3: ' . &rtp
  1207. AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'yyy/ftdetect', 'yyy/after/ftdetect'], g:total_order[0:3]
  1208. Assert index(g:total_order, 'xxx/plugin') < index(g:total_order, 'yyy/plugin')
  1209. Assert index(g:total_order, 'xxx/after/plugin') < index(g:total_order, 'yyy/after/plugin')
  1210. AssertEqual len + 2, len(split(&rtp, ','))
  1211. **********************************************************************
  1212. Execute (PlugClean should not try to remove unmanaged plugins inside g:plug_home):
  1213. call plug#begin('$PLUG_FIXTURES')
  1214. Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': [] }
  1215. Plug '$PLUG_FIXTURES/fzf'
  1216. Plug '$PLUG_FIXTURES/xxx'
  1217. Plug '$PLUG_FIXTURES/yyy'
  1218. call plug#end()
  1219. " Remove z1, z2
  1220. PlugClean!
  1221. AssertExpect '^\~ ', 2
  1222. AssertExpect 'Already clean', 0
  1223. PlugClean!
  1224. AssertExpect '^\~ ', 0
  1225. AssertExpect 'Already clean', 1
  1226. q
  1227. **********************************************************************
  1228. Execute (PlugSnapshot / #154 issues with paths containing spaces):
  1229. let $TMPDIR = '/tmp'
  1230. call plug#begin('$TMPDIR/plug with spaces')
  1231. Plug 'junegunn/vim-easy-align'
  1232. Plug 'junegunn/seoul256.vim'
  1233. call plug#end()
  1234. PlugClean!
  1235. PlugInstall
  1236. call plug#load('vim-easy-align') " Should properly handle paths with spaces
  1237. PlugSnapshot
  1238. AssertEqual '" Generated by vim-plug', getline(1)
  1239. AssertEqual 0, stridx(getline(6), "silent! let g:plugs['seoul256.vim'].commit = '")
  1240. AssertEqual 0, stridx(getline(7), "silent! let g:plugs['vim-easy-align'].commit = '")
  1241. AssertEqual 'vim', &filetype
  1242. call delete(g:plug_home.'/snapshot.vim')
  1243. execute 'PlugSnapshot' escape(g:plug_home.'/snapshot.vim', ' ')
  1244. AssertEqual 'vim', &filetype
  1245. AssertEqual 'snapshot.vim', fnamemodify(expand('%'), ':t')
  1246. q
  1247. Execute(PlugSnapshot! to overwrite existing file):
  1248. call writefile(['foobar'], g:plug_home.'/snapshot.vim')
  1249. AssertEqual 'foobar', readfile(g:plug_home.'/snapshot.vim')[0]
  1250. execute 'PlugSnapshot!' escape(g:plug_home.'/snapshot.vim', ' ')
  1251. AssertEqual '" Generated by vim-plug', readfile(g:plug_home.'/snapshot.vim')[0]
  1252. q
  1253. **********************************************************************
  1254. Execute (#221 Shallow-clone and tag option):
  1255. call plug#begin(g:temp_plugged)
  1256. Plug 'junegunn/goyo.vim'
  1257. call plug#end()
  1258. PlugInstall
  1259. execute 'cd' g:plugs['goyo.vim'].dir
  1260. Assert len(split(system('git log --oneline'), '\n')) == 1
  1261. Assert filereadable('.git/shallow')
  1262. Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
  1263. PlugUpdate
  1264. q
  1265. Assert len(split(system('git log --oneline'), '\n')) > 1
  1266. Assert system('git describe --tag') =~ '^1.5.3'
  1267. Assert !filereadable('.git/shallow')
  1268. cd -
  1269. Execute (#221 Shallow-clone disabled by g:plug_shallow = 0):
  1270. call plug#begin(g:temp_plugged)
  1271. call plug#end()
  1272. PlugClean!
  1273. let g:plug_shallow = 0
  1274. call plug#begin(g:temp_plugged)
  1275. Plug 'junegunn/goyo.vim'
  1276. call plug#end()
  1277. PlugInstall
  1278. q
  1279. execute 'cd' g:plugs['goyo.vim'].dir
  1280. Assert len(split(system('git log --oneline'), '\n')) > 1, 'not shallow'
  1281. Assert !filereadable('.git/shallow'), 'not shallow'
  1282. cd -
  1283. unlet g:plug_shallow
  1284. Execute (#221 Shallow-clone disabled by tag):
  1285. call plug#begin(g:temp_plugged)
  1286. call plug#end()
  1287. PlugClean!
  1288. call plug#begin(g:temp_plugged)
  1289. Plug 'junegunn/goyo.vim', { 'tag': '1.5.3' }
  1290. call plug#end()
  1291. Assert !isdirectory(g:plugs['goyo.vim'].dir)
  1292. PlugInstall
  1293. Assert isdirectory(g:plugs['goyo.vim'].dir)
  1294. q
  1295. execute 'cd' g:plugs['goyo.vim'].dir
  1296. Assert system('git describe --tag') =~ '^1.5.3'
  1297. Assert len(split(system('git log --oneline'), '\n')) > 1
  1298. Assert !filereadable('.git/shallow')
  1299. cd -
  1300. Execute (Commit hash support):
  1301. " Get goyo back to master
  1302. call plug#begin(g:temp_plugged)
  1303. Plug 'junegunn/goyo.vim'
  1304. call plug#end()
  1305. PlugUpdate
  1306. call plug#begin(g:temp_plugged)
  1307. Plug 'junegunn/goyo.vim', { 'commit': 'ffffffff' }
  1308. Plug 'junegunn/vim-emoji', { 'commit': '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a' }
  1309. call plug#end()
  1310. PlugUpdate
  1311. Log getline(1, '$')
  1312. AssertEqual 'x goyo.vim:', getline(5)
  1313. AssertEqual ' fatal: invalid reference: ffffffff', getline(6)
  1314. AssertEqual 0, stridx(getline(7), '- vim-emoji: HEAD is now at 9db7fcf')
  1315. let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
  1316. AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
  1317. " Validate error formatting
  1318. PlugStatus
  1319. Log getline(1, '$')
  1320. AssertEqual ['Finished. 1 error(s).',
  1321. \'[==]',
  1322. \'',
  1323. \'x goyo.vim:'], getline(1, 4)
  1324. Assert getline(5) =~ ' Invalid HEAD (expected: fffffff, actual: [0-9a-f]\{7})'
  1325. AssertEqual [' PlugUpdate required.',
  1326. \'- vim-emoji: OK'], getline(6, '$')
  1327. " PlugDiff should show pending updates for vim-emoji
  1328. PlugDiff
  1329. Log getline(1, '$')
  1330. AssertEqual '0 plugin(s) updated. 1 plugin(s) have pending updates.', getline(1)
  1331. Assert !empty(mapcheck('o'))
  1332. Assert empty(mapcheck('X'))
  1333. Assert !empty(mapcheck("\<cr>"))
  1334. " Nor in PlugSnapshot output
  1335. PlugSnapshot
  1336. Log getline(1, '$')
  1337. AssertEqual 8, line('$')
  1338. q
  1339. Execute (Commit hash support - cleared):
  1340. call plug#begin(g:temp_plugged)
  1341. Plug 'junegunn/goyo.vim'
  1342. Plug 'junegunn/vim-emoji'
  1343. call plug#end()
  1344. PlugInstall
  1345. let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
  1346. AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
  1347. PlugUpdate
  1348. let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
  1349. AssertNotEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
  1350. q
  1351. Execute (#371 - 'as' option):
  1352. call plug#begin()
  1353. Plug 'jg/goyo.vim'
  1354. Plug 'junegunn/goyo.vim', {'as': 'yogo'}
  1355. call plug#end()
  1356. AssertEqual ['goyo.vim', 'yogo'], sort(keys(g:plugs))
  1357. Log g:plugs
  1358. Assert g:plugs.yogo.dir =~# '/yogo/$'
  1359. call plug#begin()
  1360. Plug 'junegunn/goyo.vim', {'as': 'yogo', 'dir': '/tmp/vim-plug-test/gogo'}
  1361. call plug#end()
  1362. AssertEqual ['yogo'], sort(keys(g:plugs))
  1363. AssertEqual '/tmp/vim-plug-test/gogo/', g:plugs.yogo.dir
  1364. Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
  1365. if str2nr(split(split(system('git --version'))[-1], '\.')[0]) < 2
  1366. Log 'tag with wildcard requires git 1.9.2 or above'
  1367. else
  1368. call plug#begin()
  1369. Plug 'junegunn/vim-easy-align', { 'tag': '2.9.*' }
  1370. call plug#end()
  1371. PlugInstall!
  1372. Log getline(1, '$')
  1373. AssertExpect! '- Latest tag for 2.9.* -> 2.9.7 (vim-easy-align)', 1
  1374. q
  1375. AssertEqual '2.9.7', GitTag('vim-easy-align')
  1376. endif
  1377. Execute (#530 - Comparison of compatible git URIs):
  1378. " .git suffix
  1379. Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/vim-plug')
  1380. " user@
  1381. Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://user@github.com/junegunn/vim-plug.git')
  1382. " git::@
  1383. Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://git::@github.com/junegunn/vim-plug.git')
  1384. " https and ssh
  1385. Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'git@github.com:junegunn/vim-plug.git')
  1386. " file://
  1387. Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug')
  1388. Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug/')
  1389. Execute (#530 - Comparison of incompatible git URIs):
  1390. " Different hostname
  1391. Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://bitbucket.com/junegunn/vim-plug.git')
  1392. " Different repository
  1393. Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/emacs-plug.git')
  1394. " Different port
  1395. Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com:12345/junegunn/vim-plug.git')
  1396. Execute (#532 - Reuse plug window):
  1397. call plug#begin()
  1398. Plug 'junegunn/goyo.vim'
  1399. call plug#end()
  1400. PlugInstall
  1401. call system(printf('cd "%s" && git commit --allow-empty -m "dummy"', g:plugs['goyo.vim'].dir))
  1402. PlugDiff
  1403. AssertEqual 1, winnr(), 'Current window is #1 after PlugDiff (but is '.winnr().')'
  1404. AssertEqual 2, winnr('$'), 'Two windows after PlugDiff (but got '.winnr('$').')'
  1405. " Open preview window
  1406. execute "normal ]]jo"
  1407. AssertEqual 2, winnr(), 'Current window is #2 after opening preview (but is '.winnr().')'
  1408. AssertEqual 3, winnr('$'), 'Three windows with preview (but got '.winnr('$').')'
  1409. " Move plug window to the right
  1410. wincmd L
  1411. AssertEqual 3, winnr(), 'Current window is #3 after moving window (but is '.winnr().')'
  1412. AssertEqual 3, winnr('$'), 'Three windows after moving window (but got '.winnr('$').')'
  1413. " Reuse plug window. Preview window is closed.
  1414. PlugStatus
  1415. AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')'
  1416. AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
  1417. q
  1418. Execute (#766 - Allow cloning into an empty directory):
  1419. let d = '/tmp/vim-plug-test/goyo-already'
  1420. call system('rm -rf ' . d)
  1421. call mkdir(d)
  1422. call plug#begin()
  1423. Plug 'junegunn/goyo.vim', { 'dir': d }
  1424. call plug#end()
  1425. PlugInstall
  1426. AssertExpect! '[=]', 1
  1427. q
  1428. unlet d