workflow.vader 49 KB

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