unit_tests.vim 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472
  1. " MRU plugin unit-tests
  2. " MRU plugin settings
  3. let MRU_File='vim_mru_file'
  4. let MRU_Auto_Close=1
  5. let MRU_Max_Entries=10
  6. let MRU_buffer_name = '-RecentFiles-'
  7. " Set the following variable to 1, to profile the MRU plugin
  8. let s:do_profile=0
  9. " Profile the MRU plugin
  10. if s:do_profile
  11. profile start mru_profile.txt
  12. profile! file */mru.vim
  13. endif
  14. source ../plugin/mru.vim
  15. " Function to log test results
  16. func! LogResult(test, result)
  17. redir >> results.txt
  18. silent echon "\r" . a:test . ': ' . a:result . "\n"
  19. redir END
  20. endfunc
  21. " ==========================================================================
  22. " Test1
  23. " When the MRU list is empty, invoking the MRU command should return an error
  24. " ==========================================================================
  25. func Test_01()
  26. let test_name = 'test1'
  27. redir => msg
  28. MRU
  29. redir END
  30. if msg =~# "MRU file list is empty"
  31. call LogResult(test_name, 'pass')
  32. else
  33. call LogResult(test_name, 'FAIL')
  34. endif
  35. endfunc
  36. " ==========================================================================
  37. " Test2
  38. " Open the MRU window and check the order of files listed in the window
  39. " Open the MRU window when the window is already opened.
  40. " ==========================================================================
  41. func Test_02()
  42. let test_name = 'test2'
  43. edit file1.txt
  44. edit file2.txt
  45. edit file3.txt
  46. edit file2.txt
  47. edit file1.txt
  48. MRU
  49. MRU
  50. let l = getline(1, "$")
  51. if l[0] =~# "file1.txt" && l[1] =~# "file2.txt" && l[2] =~# "file3.txt"
  52. call LogResult(test_name, 'pass')
  53. else
  54. call LogResult(test_name, 'FAIL')
  55. endif
  56. endfunc
  57. " ==========================================================================
  58. " Test3
  59. " Select a file from the MRU window and check whether it is opened
  60. " ==========================================================================
  61. func Test_03()
  62. let test_name = 'test3'
  63. " Go to the last but one line
  64. $
  65. " Select the last file in the MRU window
  66. exe "normal \<Enter>"
  67. if fnamemodify(@%, ':p:t') !=# 'file3.txt'
  68. call LogResult(test_name, "FAIL (1)")
  69. else
  70. " Make sure the MRU window is closed
  71. if bufwinnr(g:MRU_buffer_name) == -1
  72. call LogResult(test_name, 'pass')
  73. else
  74. call LogResult(test_name, "FAIL (2)")
  75. endif
  76. endif
  77. endfunc
  78. " ==========================================================================
  79. " Test4
  80. " MRU opens a selected file in the previous/last window
  81. " ==========================================================================
  82. func Test_04()
  83. let test_name = 'test4'
  84. " Edit a file and then open a new window, open the MRU window and select the
  85. " file
  86. split file1.txt
  87. only
  88. below new
  89. MRU
  90. call search('file2.txt')
  91. exe "normal \<Enter>"
  92. if winnr() == 2
  93. call LogResult(test_name, 'pass')
  94. else
  95. call LogResult(test_name, 'FAIL')
  96. endif
  97. endfunc
  98. " ==========================================================================
  99. " Test5
  100. " MRU opens a selected file in the same window if the file is already opened
  101. " ==========================================================================
  102. func Test_05()
  103. let test_name = 'test5'
  104. edit file1.txt
  105. only
  106. below split file2.txt
  107. below split file3.txt
  108. MRU
  109. call search('file1.txt')
  110. exe "normal \<Enter>"
  111. if winnr() != 1 || fnamemodify(@%, ':p:t') !=# 'file1.txt'
  112. call LogResult(test_name, "FAIL (1)")
  113. else
  114. MRU
  115. call search('file2.txt')
  116. exe "normal \<Enter>"
  117. if winnr() != 2 || fnamemodify(@%, ':p:t') !=# 'file2.txt'
  118. call LogResult(test_name, "FAIL (2)")
  119. else
  120. MRU
  121. call search('file3.txt')
  122. exe "normal \<Enter>"
  123. if winnr() != 3 || fnamemodify(@%, ':p:t') !=# 'file3.txt'
  124. call LogResult(test_name, "FAIL (3)")
  125. else
  126. call LogResult(test_name, 'pass')
  127. endif
  128. endif
  129. endif
  130. endfunc
  131. " ==========================================================================
  132. " Test6
  133. " MRU opens a file selected with 'o' command in a new window
  134. " ==========================================================================
  135. func Test_06()
  136. let test_name = 'test6'
  137. enew | only
  138. edit file1.txt
  139. below new
  140. MRU
  141. normal o
  142. if winnr() == 3 && fnamemodify(@%, ':p:t') ==# 'file1.txt'
  143. call LogResult(test_name, 'pass')
  144. else
  145. call LogResult(test_name, 'FAIL')
  146. endif
  147. endfunc
  148. " ==========================================================================
  149. " Test7
  150. " MRU opens the selected file in a new window if the previous buffer is
  151. " modified.
  152. " ==========================================================================
  153. func Test_07()
  154. let test_name = 'test7'
  155. enew | only
  156. insert
  157. MRU plugin test
  158. .
  159. MRU
  160. call search('file3.txt')
  161. exe "normal \<Enter>"
  162. if winnr() == 1 && winnr('$') == 2 &&
  163. \ fnamemodify(@%, ':p:t') ==# 'file3.txt'
  164. call LogResult(test_name, 'pass')
  165. else
  166. call LogResult(test_name, 'FAIL')
  167. endif
  168. " Discard changes in the new buffer
  169. wincmd b
  170. enew!
  171. only
  172. endfunc
  173. " ==========================================================================
  174. " Test8
  175. " MRU opens a file selected with 'v' command in read-only mode in the current
  176. " window.
  177. " ==========================================================================
  178. func Test_08()
  179. let test_name = 'test8'
  180. enew | only
  181. MRU
  182. call search('file1.txt')
  183. normal v
  184. let r1 = &readonly
  185. MRU
  186. call search('file2.txt')
  187. exe "normal \<Enter>"
  188. let r2 = &readonly
  189. MRU
  190. call search('file1.txt')
  191. exe "normal \<Enter>"
  192. let r3 = &readonly
  193. if r1 == 1 && r2 == 0 && r3 == 1
  194. call LogResult(test_name, 'pass')
  195. else
  196. call LogResult(test_name, 'FAIL')
  197. endif
  198. endfunc
  199. " ==========================================================================
  200. " Test9
  201. " Use 'O' in the MRU window to open a file in a vertically split window
  202. " ==========================================================================
  203. func Test_09()
  204. let test_name = 'test9'
  205. enew | only
  206. edit file1.txt
  207. MRU
  208. call search('file2.txt')
  209. normal O
  210. let b1 = @%
  211. wincmd h
  212. let b2 = @%
  213. wincmd l
  214. let b3 = @%
  215. if winnr('$') == 2 && b1 ==# 'file2.txt' &&
  216. \ b2 ==# 'file1.txt' && b3 ==# 'file2.txt'
  217. call LogResult(test_name, 'pass')
  218. else
  219. call LogResult(test_name, 'FAIL')
  220. endif
  221. endfunc
  222. " ==========================================================================
  223. " Test10
  224. " Use 'p' in the MRU window to open a file in the preview window
  225. " ==========================================================================
  226. func Test_10()
  227. let test_name = 'test10'
  228. enew | only
  229. MRU
  230. call search('file3.txt')
  231. normal p
  232. wincmd P
  233. let p1 = &previewwindow
  234. let b1 = @%
  235. if winnr('$') == 2 && &previewwindow && @% =~# 'file3.txt'
  236. call LogResult(test_name, 'pass')
  237. else
  238. call LogResult(test_name, 'FAIL')
  239. endif
  240. pclose
  241. endfunc
  242. " ==========================================================================
  243. " Test11
  244. " MRU opens a file selected with 't' command in a new tab and the tab
  245. " is opened at the end
  246. " ==========================================================================
  247. func Test_11()
  248. let test_name = 'test11'
  249. enew | only
  250. edit a1.txt
  251. tabnew a2.txt
  252. tabnew a3.txt
  253. tabnew a4.txt
  254. tabfirst
  255. MRU
  256. call search('file3.txt')
  257. normal t
  258. if fnamemodify(@%, ':p:t') ==# 'file3.txt' && tabpagenr() == 5
  259. call LogResult(test_name, 'pass')
  260. else
  261. call LogResult(test_name, 'FAIL')
  262. call LogResult(test_name, "file = " . fnamemodify(@%, ':p:t'))
  263. call LogResult(test_name, "tab page = " . tabpagenr())
  264. endif
  265. tabonly
  266. endfunc
  267. " ==========================================================================
  268. " Test12
  269. " The 'q' command closes the MRU window
  270. " ==========================================================================
  271. func Test_12()
  272. let test_name = 'test12'
  273. enew | only
  274. MRU
  275. normal q
  276. if bufwinnr(g:MRU_buffer_name) == -1
  277. call LogResult(test_name, 'pass')
  278. else
  279. call LogResult(test_name, 'FAIL')
  280. endif
  281. endfunc
  282. " ==========================================================================
  283. " Test13
  284. " A selected file is opened in a new window if the previous window is a
  285. " preview window
  286. " ==========================================================================
  287. func Test_13()
  288. let test_name = 'test13'
  289. enew | only
  290. setlocal previewwindow
  291. MRU
  292. call search('file2.txt')
  293. exe "normal \<Enter>"
  294. if winnr() == 1 && winnr('$') == 2 &&
  295. \ &previewwindow == 0 &&
  296. \ fnamemodify(@%, ':p:t') ==# 'file2.txt'
  297. call LogResult(test_name, 'pass')
  298. else
  299. call LogResult(test_name, 'FAIL')
  300. endif
  301. " Close the preview window created by this test
  302. new
  303. only
  304. endfunc
  305. " ==========================================================================
  306. " Test14
  307. " A selected file is opened in a new window if the previous window contains
  308. " a special buffer (used by some other plugin)
  309. " ==========================================================================
  310. func Test_14()
  311. let test_name = 'test14'
  312. enew | only
  313. setlocal buftype=nofile
  314. MRU
  315. call search('file3.txt')
  316. exe "normal \<Enter>"
  317. if winnr() == 1 && winnr('$') == 2 &&
  318. \ &buftype == '' &&
  319. \ fnamemodify(@%, ':p:t') ==# 'file3.txt'
  320. call LogResult(test_name, 'pass')
  321. else
  322. call LogResult(test_name, 'FAIL')
  323. endif
  324. " Discard the special buffer
  325. enew
  326. endfunc
  327. " ==========================================================================
  328. " Test15
  329. " If a file selected using the 't' command is already opened in a tab,
  330. " then jump to that tab (instead of opening a new tab)
  331. " ==========================================================================
  332. func Test_15()
  333. let test_name = 'test15'
  334. enew | only
  335. " Open the test files in the middle window with empty windows at the top and
  336. " bottom
  337. edit file1.txt
  338. above new
  339. botright new
  340. tabedit file2.txt
  341. above new
  342. botright new
  343. tabedit file3.txt
  344. above new
  345. botright new
  346. tabfirst
  347. MRU
  348. call search('file3.txt')
  349. exe "normal t"
  350. if tabpagenr() != 3
  351. \ || fnamemodify(@%, ':p:t') !=# 'file3.txt'
  352. \ || winnr() != 2
  353. call LogResult(test_name, "FAIL (1)")
  354. else
  355. MRU
  356. call search('file1.txt')
  357. exe "normal t"
  358. if tabpagenr() != 1
  359. \ || fnamemodify(@%, ':p:t') !=# 'file1.txt'
  360. \ || winnr() != 2
  361. call LogResult(test_name, "FAIL (2)")
  362. else
  363. MRU
  364. call search('file2.txt')
  365. exe "normal t"
  366. if tabpagenr() != 2
  367. \ || fnamemodify(@%, ':p:t') !=# 'file2.txt'
  368. \ || winnr() != 2
  369. call LogResult(test_name, "FAIL (3)")
  370. else
  371. call LogResult(test_name, 'pass')
  372. endif
  373. endif
  374. endif
  375. " Close all the other tabs
  376. tabonly
  377. enew
  378. only
  379. endfunc
  380. " ==========================================================================
  381. " Test16
  382. " Open multiple files from the MRU window using the visual mode and by using a
  383. " count. Each file should be opened in a separate window.
  384. " ==========================================================================
  385. func Test_16()
  386. let test_name = 'test16'
  387. enew | only
  388. edit file3.txt
  389. edit file2.txt
  390. edit file1.txt
  391. enew
  392. MRU
  393. exe "normal 3\<Enter>"
  394. if winnr('$') == 3 &&
  395. \ bufwinnr('file3.txt') == 1 &&
  396. \ bufwinnr('file2.txt') == 2 &&
  397. \ bufwinnr('file1.txt') == 3
  398. let test_result = 'pass'
  399. else
  400. let test_result = 'FAIL'
  401. endif
  402. only | enew
  403. if test_result == 'pass'
  404. MRU
  405. exe "normal V2j\<Enter>"
  406. if winnr('$') == 3 &&
  407. \ bufwinnr('file1.txt') == 1 &&
  408. \ bufwinnr('file2.txt') == 2 &&
  409. \ bufwinnr('file3.txt') == 3
  410. let test_result = 'pass'
  411. else
  412. let test_result = 'FAIL'
  413. endif
  414. endif
  415. if test_result == 'pass'
  416. call LogResult(test_name, 'pass')
  417. else
  418. call LogResult(test_name, 'FAIL')
  419. endif
  420. endfunc
  421. " ==========================================================================
  422. " Test17
  423. " When the MRU list is updated, the MRU file also should updated.
  424. " ==========================================================================
  425. func Test_17()
  426. let test_name = 'test17'
  427. enew | only
  428. edit file1.txt
  429. let l = readfile(g:MRU_File)
  430. if l[1] =~# 'file1.txt'
  431. edit file2.txt
  432. let l = readfile(g:MRU_File)
  433. if l[1] =~# 'file2.txt'
  434. edit file3.txt
  435. let l = readfile(g:MRU_File)
  436. if l[1] =~# 'file3.txt'
  437. call LogResult(test_name, 'pass')
  438. else
  439. call LogResult(test_name, "FAIL (3)")
  440. endif
  441. else
  442. call LogResult(test_name, "FAIL (2)")
  443. endif
  444. else
  445. call LogResult(test_name, "FAIL (1)")
  446. endif
  447. endfunc
  448. " MRU_Test_Add_Files
  449. " Add the supplied List of files to the beginning of the MRU file
  450. func! s:MRU_Test_Add_Files(fnames)
  451. let l = readfile(g:MRU_File)
  452. call extend(l, a:fnames, 1)
  453. call writefile(l, g:MRU_File)
  454. endfunc
  455. " ==========================================================================
  456. " Test18
  457. " When the MRU file is updated by another Vim instance, the MRU plugin
  458. " should update the MRU list
  459. " ==========================================================================
  460. func Test_18()
  461. let test_name = 'test18'
  462. enew | only
  463. call s:MRU_Test_Add_Files(['/software/editors/vim',
  464. \ '/software/editors/emacs',
  465. \ '/software/editors/nano'])
  466. MRU
  467. if getline(1) ==# 'vim (/software/editors/vim)'
  468. \ && getline(2) ==# 'emacs (/software/editors/emacs)'
  469. \ && getline(3) ==# 'nano (/software/editors/nano)'
  470. call LogResult(test_name, 'pass')
  471. else
  472. call LogResult(test_name, 'FAIL')
  473. endif
  474. " Close the MRU window
  475. close
  476. endfunc
  477. " ==========================================================================
  478. " Test19
  479. " When the MRU file is updated by another Vim instance, the MRU file names
  480. " from the current instance should be merged with that list
  481. " ==========================================================================
  482. func Test_19()
  483. let test_name = 'test19'
  484. enew | only
  485. " Remove all the files from the MRU file
  486. let l = readfile(g:MRU_File)
  487. call remove(l, 1, -1)
  488. call writefile(l, g:MRU_File)
  489. edit file1.txt
  490. call s:MRU_Test_Add_Files(['/software/os/unix'])
  491. edit file2.txt
  492. call s:MRU_Test_Add_Files(['/software/os/windows'])
  493. edit file3.txt
  494. call s:MRU_Test_Add_Files(['/software/os/osx'])
  495. MRU
  496. if getline(1) ==# 'osx (/software/os/osx)'
  497. \ && getline(2) =~# 'file3.txt'
  498. \ && getline(3) ==# 'windows (/software/os/windows)'
  499. \ && getline(4) =~# 'file2.txt'
  500. \ && getline(5) ==# 'unix (/software/os/unix)'
  501. \ && getline(6) =~# 'file1.txt'
  502. call LogResult(test_name, 'pass')
  503. else
  504. call LogResult(test_name, 'FAIL')
  505. endif
  506. close
  507. endfunc
  508. " ==========================================================================
  509. " Test20
  510. " When the MRU list has more than g:MRU_Max_Entries, the list should be
  511. " trimmed. The last entries should be removed.
  512. " ==========================================================================
  513. func Test_20()
  514. let test_name = 'test20'
  515. enew | only
  516. " Create a MRU list with MRU_Max_Entries
  517. let flist = []
  518. for i in range(1, g:MRU_Max_Entries)
  519. let flist += ['/usr/share/mru_test/mru_file' . i . '.abc']
  520. endfor
  521. " Modify the MRU file to contain max entries
  522. let l = readfile(g:MRU_File)
  523. call remove(l, 1, -1)
  524. call extend(l, flist)
  525. call writefile(l, g:MRU_File)
  526. enew
  527. edit file1.txt
  528. let l = readfile(g:MRU_File)
  529. if len(l) == (g:MRU_Max_Entries + 1) &&
  530. \ l[g:MRU_Max_Entries] != '/usr/share/mru_test/mru_file9.abc'
  531. call LogResult(test_name, "FAIL (1)")
  532. else
  533. edit file2.txt
  534. let l = readfile(g:MRU_File)
  535. if len(l) == (g:MRU_Max_Entries + 1) &&
  536. \ l[g:MRU_Max_Entries] != '/usr/share/mru_test/mru_file8.abc'
  537. call LogResult(test_name, "FAIL (2)")
  538. else
  539. edit file3.txt
  540. let l = readfile(g:MRU_File)
  541. if len(l) == (g:MRU_Max_Entries + 1) &&
  542. \ l[g:MRU_Max_Entries] != '/usr/share/mru_test/mru_file7.abc'
  543. call LogResult(test_name, "FAIL (3)")
  544. else
  545. call LogResult(test_name, 'pass')
  546. endif
  547. endif
  548. endif
  549. endfunc
  550. " ==========================================================================
  551. " Test21
  552. " When an filename (already present in the MRU list) is specified to the MRU
  553. " command, it should edit the file.
  554. " ==========================================================================
  555. func Test_21()
  556. let test_name = 'test21'
  557. enew | only
  558. edit file1.txt
  559. edit file2.txt
  560. edit file3.txt
  561. enew
  562. MRU file2.txt
  563. if fnamemodify(@%, ':p:t') ==# 'file2.txt' && winnr('$') == 1
  564. call LogResult(test_name, 'pass')
  565. else
  566. call LogResult(test_name, 'FAIL')
  567. endif
  568. endfunc
  569. " ==========================================================================
  570. " Test22
  571. " When a pattern (matching multiple filenames) is specified to the MRU
  572. " command, then the MRU window should be opened with all the matching
  573. " filenames
  574. " ==========================================================================
  575. func Test_22()
  576. let test_name = 'test22'
  577. enew | only
  578. edit file1.txt
  579. edit file2.txt
  580. edit file3.txt
  581. only
  582. MRU file.*
  583. if @% != g:MRU_buffer_name
  584. call LogResult(test_name, 'FAIL')
  585. else
  586. let l = getline(1, "$")
  587. if l[0] =~# "file3.txt" && l[1] =~# "file2.txt" && l[2] =~# "file1.txt"
  588. call LogResult(test_name, 'pass')
  589. else
  590. call LogResult(test_name, 'FAIL')
  591. endif
  592. endif
  593. close
  594. endfunc
  595. " ==========================================================================
  596. " Test23
  597. " When a partial filename (matching multiple filenames) is specified to the
  598. " MRU command, then the MRU window should be opened with all the matching
  599. " filenames
  600. " ==========================================================================
  601. func Test_23()
  602. let test_name = 'test23'
  603. enew | only
  604. let g:MRU_FuzzyMatch = 0
  605. edit file1.txt
  606. edit file2.txt
  607. edit file3.txt
  608. only
  609. MRU file
  610. if @% != g:MRU_buffer_name
  611. call LogResult(test_name, 'FAIL')
  612. else
  613. let l = getline(1, "$")
  614. if l[0] =~# "file3.txt" && l[1] =~# "file2.txt" && l[2] =~# "file1.txt"
  615. call LogResult(test_name, 'pass')
  616. else
  617. call LogResult(test_name, 'FAIL')
  618. endif
  619. endif
  620. close
  621. endfunc
  622. " ==========================================================================
  623. " Test24
  624. " When a non-existing filename is specified to the MRU command, an error
  625. " message should be displayed.
  626. " ==========================================================================
  627. func Test_24()
  628. let test_name = 'test24'
  629. let g:MRU_FuzzyMatch = 0
  630. redir => msg
  631. MRU nonexistingfile.txt
  632. redir END
  633. if @% == g:MRU_buffer_name ||
  634. \ msg !~# "MRU file list doesn't contain files " .
  635. \ "matching nonexistingfile.txt"
  636. call LogResult(test_name, 'FAIL')
  637. else
  638. call LogResult(test_name, 'pass')
  639. endif
  640. endfunc
  641. " ==========================================================================
  642. " Test25
  643. " The MRU command should support filename completion. Supply a partial file
  644. " name to the MRU command and complete the filenames.
  645. " ==========================================================================
  646. func Test_25()
  647. let test_name = 'test25'
  648. enew | only
  649. edit file1.txt
  650. edit file2.txt
  651. edit file3.txt
  652. exe 'normal! :MRU file' . "\<C-A>" . "\<Home>let m='\<End>'\<CR>"
  653. let fnames = split(m)
  654. if fnames[1] =~# 'file3.txt' && fnames[2] =~# 'file2.txt' &&
  655. \ fnames[3] =~# 'file1.txt'
  656. call LogResult(test_name, 'pass')
  657. else
  658. call LogResult(test_name, 'FAIL')
  659. endif
  660. endfunc
  661. " ==========================================================================
  662. " Test26
  663. " When trying to complete filenames for the MRU command without specifying
  664. " any text should return the entire MRU list.
  665. " ==========================================================================
  666. func Test_26()
  667. let test_name = 'test26'
  668. enew | only
  669. call delete(g:MRU_File)
  670. edit file1.txt
  671. edit file2.txt
  672. edit file3.txt
  673. exe 'normal! :MRU ' . "\<C-A>" . "\<Home>let m='\<End>'\<CR>"
  674. let fnames = split(m)
  675. if fnames[1] =~# 'file3.txt' && fnames[2] =~# 'file2.txt' &&
  676. \ fnames[3] =~# 'file1.txt'
  677. call LogResult(test_name, 'pass')
  678. else
  679. call LogResult(test_name, 'FAIL')
  680. endif
  681. endfunc
  682. " ==========================================================================
  683. " Test27
  684. " When the current file/buffer has unsaved changes, MRU should open a selected
  685. " file in a new window (if the 'hidden' option is not set)
  686. " ==========================================================================
  687. func Test_27()
  688. let test_name = 'test27'
  689. enew | only
  690. edit file1.txt
  691. edit file2.txt
  692. call append(line('$'), 'Temporary changes to buffer')
  693. MRU
  694. call search('file1.txt')
  695. exe "normal \<Enter>"
  696. if winnr() == 1 && winnr('$') == 2 &&
  697. \ fnamemodify(@%, ':p:t') ==# 'file1.txt'
  698. call LogResult(test_name, 'pass')
  699. else
  700. call LogResult(test_name, 'FAIL')
  701. endif
  702. close
  703. edit!
  704. endfunc
  705. " ==========================================================================
  706. " Test28
  707. " When the current file/buffer has unsaved changes and the 'hidden' option is
  708. " set, then MRU should open a selected file in the current window
  709. " ==========================================================================
  710. func Test_28()
  711. let test_name = 'test28'
  712. enew | only
  713. edit file2.txt
  714. edit file1.txt
  715. call append(line('$'), 'Temporary changes to buffer')
  716. set hidden
  717. MRU
  718. call search('file2.txt')
  719. exe "normal \<Enter>"
  720. if winnr('$') == 1 &&
  721. \ fnamemodify(@%, ':p:t') ==# 'file2.txt'
  722. call LogResult(test_name, 'pass')
  723. else
  724. call LogResult(test_name, 'FAIL')
  725. endif
  726. edit file1.txt
  727. edit!
  728. set nohidden
  729. %bw!
  730. endfunc
  731. " ==========================================================================
  732. " Test29
  733. " Every edited file is added to the top of the MRU list. If a file is already
  734. " present in the MRU list, then it is moved to the top of the list.
  735. " ==========================================================================
  736. func Test_29()
  737. let test_name = 'test29'
  738. enew | only
  739. edit file1.txt
  740. let f1 = readfile(g:MRU_File, '', 2)
  741. edit file2.txt
  742. let f2 = readfile(g:MRU_File, '', 2)
  743. edit file3.txt
  744. let f3 = readfile(g:MRU_File, '', 2)
  745. edit file1.txt
  746. let f4 = readfile(g:MRU_File, '', 2)
  747. if f1[1] =~# 'file1.txt' && f2[1] =~# 'file2.txt' && f3[1] =~# 'file3.txt' &&
  748. \ f4[1] =~# 'file1.txt'
  749. call LogResult(test_name, 'pass')
  750. else
  751. call LogResult(test_name, 'FAIL')
  752. endif
  753. endfunc
  754. " ==========================================================================
  755. " Test30
  756. " Only file names matching the regular expression in the MRU_Include_Files
  757. " variable should be added to the MRU list.
  758. " ==========================================================================
  759. func Test_30()
  760. let test_name = 'test30'
  761. enew | only
  762. edit file1.txt
  763. let g:MRU_Include_Files='\.c'
  764. edit abc.c
  765. let f1 = readfile(g:MRU_File, '', 2)
  766. edit file1.txt
  767. let f2 = readfile(g:MRU_File, '', 2)
  768. edit def.c
  769. let f3 = readfile(g:MRU_File, '', 2)
  770. if f1[1] =~# 'abc.c' && f2[1] =~# 'abc.c' && f3[1] =~# 'def.c'
  771. call LogResult(test_name, 'pass')
  772. else
  773. call LogResult(test_name, 'FAIL')
  774. endif
  775. let g:MRU_Include_Files=''
  776. endfunc
  777. " ==========================================================================
  778. " Test31
  779. " File names matching the regular expression in the MRU_Exclude_Files
  780. " variable should not be added to the MRU list.
  781. " ==========================================================================
  782. func Test_31()
  783. let test_name = 'test31'
  784. enew | only
  785. let g:MRU_Exclude_Files='\.txt'
  786. edit abc.c
  787. let f1 = readfile(g:MRU_File, '', 2)
  788. edit file1.txt
  789. edit file2.txt
  790. edit file3.txt
  791. let f2 = readfile(g:MRU_File, '', 2)
  792. edit def.c
  793. let f3 = readfile(g:MRU_File, '', 2)
  794. let g:MRU_Exclude_Files=''
  795. edit file1.txt
  796. let f4 = readfile(g:MRU_File, '', 2)
  797. if f1[1] =~# 'abc.c' && f2[1] =~# 'abc.c' && f3[1] =~# 'def.c' &&
  798. \ f4[1] =~# 'file1.txt'
  799. call LogResult(test_name, 'pass')
  800. else
  801. call LogResult(test_name, 'FAIL')
  802. endif
  803. endfunc
  804. " ==========================================================================
  805. " Test32
  806. " If the MRU window is open, when adding a file name to the list, the MRU
  807. " window should be refreshed.
  808. " ==========================================================================
  809. func Test_32()
  810. let test_name = 'test32'
  811. enew | only
  812. MRU
  813. wincmd p
  814. edit abc.c
  815. wincmd p
  816. let s1 = getline(1)
  817. wincmd p
  818. edit file1.txt
  819. wincmd p
  820. let s2 = getline(1)
  821. close
  822. if s1 =~# 'abc.c' && s2 =~# 'file1.txt'
  823. call LogResult(test_name, 'pass')
  824. else
  825. call LogResult(test_name, 'FAIL')
  826. endif
  827. endfunc
  828. " ==========================================================================
  829. " Test33
  830. " When MRU_Use_Current_Window is set, the MRU list should be displayed in
  831. " the current window.
  832. " Selecting a file from the MRU window should replace
  833. " the MRU buffer with the selected file.
  834. " ==========================================================================
  835. func Test_33()
  836. let test_name = 'test33'
  837. enew | only
  838. edit file1.txt
  839. let g:MRU_Use_Current_Window=1
  840. MRU
  841. if winnr('$') == 1 && @% == g:MRU_buffer_name
  842. call LogResult(test_name, 'pass')
  843. else
  844. call LogResult(test_name, 'FAIL')
  845. endif
  846. let g:MRU_Use_Current_Window=0
  847. endfunc
  848. " ==========================================================================
  849. " Test34
  850. " When MRU_Use_Current_Window is set, selecting a file from the MRU window
  851. " should replace the MRU buffer with the selected file.
  852. " ==========================================================================
  853. func Test_34()
  854. let test_name = 'test34'
  855. enew | only
  856. let g:MRU_Use_Current_Window=1
  857. let w:marker=1
  858. MRU
  859. if winnr('$') == 1 && w:marker && @% == g:MRU_buffer_name
  860. call search('file2.txt')
  861. exe "normal \<Enter>"
  862. if winnr('$') == 1 && w:marker && @% == 'file2.txt'
  863. call LogResult(test_name, 'pass')
  864. else
  865. call LogResult(test_name, 'FAIL')
  866. endif
  867. else
  868. call LogResult(test_name, 'FAIL')
  869. endif
  870. unlet w:marker
  871. let g:MRU_Use_Current_Window=0
  872. endfunc
  873. " ==========================================================================
  874. " Test35
  875. " When MRU_Use_Current_Window is set, if the current buffer has unsaved
  876. " changes, then the MRU window should be opened in a split window
  877. " ==========================================================================
  878. func Test_35()
  879. let test_name = 'test35'
  880. enew | only
  881. let g:MRU_Use_Current_Window=1
  882. set modified
  883. MRU
  884. if winnr('$') == 2 && winnr() == 2 && @% == g:MRU_buffer_name
  885. call LogResult(test_name, 'pass')
  886. else
  887. call LogResult(test_name, 'FAIL')
  888. endif
  889. close
  890. set nomodified
  891. let g:MRU_Use_Current_Window=0
  892. enew | only
  893. endfunc
  894. " ==========================================================================
  895. " Test36
  896. " When MRU_Auto_Close is not set, the MRU window should not automatically
  897. " close when a file is selected. The MRU window should be kept open.
  898. " ==========================================================================
  899. func Test_36()
  900. let test_name = 'test36'
  901. enew | only
  902. let g:MRU_Auto_Close=0
  903. new
  904. MRU
  905. call search('file1.txt')
  906. exe "normal \<Enter>"
  907. 2wincmd w
  908. MRU
  909. call search('file2.txt')
  910. exe "normal \<Enter>"
  911. if winnr('$') == 3 &&
  912. \ bufwinnr('file1.txt') == 1 &&
  913. \ bufwinnr('file2.txt') == 2 &&
  914. \ bufwinnr(g:MRU_buffer_name) == 3
  915. call LogResult(test_name, 'pass')
  916. else
  917. call LogResult(test_name, 'FAIL')
  918. endif
  919. wincmd b
  920. close
  921. let g:MRU_Auto_Close=1
  922. only
  923. endfunc
  924. " ==========================================================================
  925. " Test37
  926. " When MRU_Open_File_Use_Tabs is set, a selected file should be opened in a
  927. " tab. If the file is already opened in a tab, then the focus should be moved
  928. " to that tab.
  929. " ==========================================================================
  930. func Test_37()
  931. let test_name = 'test37'
  932. enew | only
  933. let g:MRU_Open_File_Use_Tabs=1
  934. edit file1.txt
  935. MRU
  936. call search('file2.txt')
  937. exe "normal \<Enter>"
  938. MRU
  939. call search('file3.txt')
  940. exe "normal \<Enter>"
  941. MRU file1.txt
  942. let t1 = tabpagenr()
  943. MRU
  944. call search('file2.txt')
  945. exe "normal \<Enter>"
  946. let t2 = tabpagenr()
  947. MRU
  948. call search('file3.txt')
  949. exe "normal \<Enter>"
  950. let t3 = tabpagenr()
  951. tabonly | enew
  952. if t1 == 1 && t2 == 2 && t3 == 3
  953. call LogResult(test_name, 'pass')
  954. else
  955. call LogResult(test_name, 'FAIL')
  956. endif
  957. let g:MRU_Open_File_Use_Tabs=0
  958. endfunc
  959. " ==========================================================================
  960. " Test38
  961. " If the MRU_Window_Open_Always is set to 0, when the MRU command finds a
  962. " single matching file name, then it should open the MRU window. If this
  963. " variable is set to 1, then the file should be opened without opening the MRU
  964. " window.
  965. " ==========================================================================
  966. func Test_38()
  967. let test_name = 'test38'
  968. enew | only
  969. edit file3.txt
  970. enew
  971. let g:MRU_Window_Open_Always=1
  972. MRU file3.txt
  973. if winnr('$') == 2 &&
  974. \ bufwinnr(g:MRU_buffer_name) == 2
  975. let test_result = 'pass'
  976. else
  977. let test_result = 'FAIL'
  978. endif
  979. close
  980. enew | only
  981. if test_result == 'pass'
  982. let g:MRU_Window_Open_Always=0
  983. MRU file3.txt
  984. if winnr('$') == 1 &&
  985. \ bufwinnr('file3.txt') == 1
  986. let test_result = 'pass'
  987. else
  988. let test_result = 'FAIL'
  989. endif
  990. endif
  991. let g:MRU_Window_Open_Always=0
  992. if test_result == 'pass'
  993. call LogResult(test_name, 'pass')
  994. else
  995. call LogResult(test_name, 'FAIL')
  996. endif
  997. endfunc
  998. " ==========================================================================
  999. " Test39
  1000. " If the current tabpage is empty, then pressing 't' in the MRU window
  1001. " should open the file in the current tabpage.
  1002. " ==========================================================================
  1003. func Test_39()
  1004. let test_name = 'test39'
  1005. enew | only | tabonly
  1006. tabnew
  1007. tabnew
  1008. tabnext 2
  1009. MRU
  1010. call search('file2.txt')
  1011. normal t
  1012. if fnamemodify(@%, ':p:t') ==# 'file2.txt' && tabpagenr() == 2
  1013. call LogResult(test_name, 'pass')
  1014. else
  1015. call LogResult(test_name, 'FAIL')
  1016. call LogResult(test_name, "file = " . fnamemodify(@%, ':p:t'))
  1017. call LogResult(test_name, "tab page = " . tabpagenr())
  1018. endif
  1019. tabonly
  1020. endfunc
  1021. " ==========================================================================
  1022. " Test40
  1023. " Pressing 'd' in the MRU window should delete the file under the cursor
  1024. " from the MRU list
  1025. " ==========================================================================
  1026. func Test_40()
  1027. let test_name = 'test40'
  1028. edit file2.txt
  1029. enew
  1030. MRU
  1031. call search('file2.txt')
  1032. normal d
  1033. close
  1034. let l = readfile(g:MRU_File)
  1035. if match(l, 'file2.txt') == -1
  1036. call LogResult(test_name, 'pass')
  1037. else
  1038. call LogResult(test_name, 'FAIL')
  1039. endif
  1040. endfunc
  1041. " ==========================================================================
  1042. " Test41
  1043. " Running the :vimgrep command should not add the files to the MRU list
  1044. " ==========================================================================
  1045. func Test_41()
  1046. let test_name = 'test41'
  1047. call writefile(['bright'], 'dummy1.txt')
  1048. call writefile(['bright'], 'dummy2.txt')
  1049. vimgrep /bright/j dummy*
  1050. let l = readfile(g:MRU_File)
  1051. if match(l, 'dummy') == -1
  1052. call LogResult(test_name, 'pass')
  1053. else
  1054. call LogResult(test_name, 'FAIL')
  1055. endif
  1056. call delete('dummy1.txt')
  1057. call delete('dummy2.txt')
  1058. endfunc
  1059. " ==========================================================================
  1060. " Test42
  1061. " Using a command modifier with the MRU command to open the MRU window
  1062. " ==========================================================================
  1063. func Test_42()
  1064. if v:version < 800
  1065. " The <mods> command modifier is supported only by Vim 8.0 and above
  1066. return
  1067. endif
  1068. let test_name = 'test42'
  1069. enew | only
  1070. topleft MRU
  1071. if winnr() == 1 && winnr('$') == 2
  1072. call LogResult(test_name, 'pass')
  1073. else
  1074. call LogResult(test_name, 'FAIL')
  1075. endif
  1076. enew | only
  1077. botright MRU
  1078. if winnr() == 2 && winnr('$') == 2
  1079. call LogResult(test_name, 'pass')
  1080. else
  1081. call LogResult(test_name, 'FAIL')
  1082. endif
  1083. enew | only
  1084. botright MRU
  1085. if winnr() == 2 && winnr('$') == 2
  1086. call LogResult(test_name, 'pass')
  1087. else
  1088. call LogResult(test_name, 'FAIL')
  1089. endif
  1090. enew | only
  1091. endfunc
  1092. " ==========================================================================
  1093. " Test43
  1094. " Opening a file using the MRU command should jump to the window containing
  1095. " the file (if it is already opened).
  1096. " ==========================================================================
  1097. func Test_43()
  1098. let test_name = 'test43'
  1099. only
  1100. edit file3.txt
  1101. below split file2.txt
  1102. below split file1.txt
  1103. wincmd t
  1104. MRU file1.txt
  1105. if winnr() != 3 || fnamemodify(@%, ':p:t') !=# 'file1.txt'
  1106. call LogResult(test_name, 'FAIL (1)')
  1107. else
  1108. MRU file2.txt
  1109. if winnr() != 2 && fnamemodify(@%, ':p:t') !=# 'file2.txt'
  1110. call LogResult(test_name, 'FAIL (2)')
  1111. else
  1112. MRU file3.txt
  1113. if winnr() != 1 && fnamemodify(@%, ':p:t') !=# 'file3.txt'
  1114. call LogResult(test_name, 'FAIL (3)')
  1115. else
  1116. call LogResult(test_name, 'pass')
  1117. endif
  1118. endif
  1119. endif
  1120. enew | only
  1121. endfunc
  1122. " ==========================================================================
  1123. " Test44
  1124. " Opening a file using the MRU command should open the file in a new window if
  1125. " the current buffer has unsaved changes.
  1126. " ==========================================================================
  1127. func Test_44()
  1128. let test_name = 'test44'
  1129. only
  1130. set modified
  1131. MRU file2.txt
  1132. if winnr('$') == 2 && winnr() == 1 &&
  1133. \ fnamemodify(@%, ':p:t') ==# 'file2.txt'
  1134. call LogResult(test_name, 'pass')
  1135. else
  1136. call LogResult(test_name, 'FAIL')
  1137. endif
  1138. close
  1139. set nomodified
  1140. endfunc
  1141. " ==========================================================================
  1142. " Test45
  1143. " Opening a file from the MRU window using 'v' should open the file in a new
  1144. " window if the current buffer has unsaved changes.
  1145. " ==========================================================================
  1146. func Test_45()
  1147. let test_name = 'test45'
  1148. only
  1149. set modified
  1150. MRU
  1151. call search('file3.txt')
  1152. normal v
  1153. if winnr('$') == 2 && winnr() == 1
  1154. \ && fnamemodify(@%, ':p:t') ==# 'file3.txt'
  1155. \ && &readonly
  1156. call LogResult(test_name, 'pass')
  1157. else
  1158. call LogResult(test_name, 'FAIL')
  1159. endif
  1160. close
  1161. set nomodified
  1162. endfunc
  1163. " ==========================================================================
  1164. " Test46
  1165. " Specify a count to the :MRU command to set the MRU window height/width
  1166. " ==========================================================================
  1167. func Test_46()
  1168. let test_name = 'test46'
  1169. only
  1170. " default height is 8
  1171. MRU
  1172. if winnr() != 2 || winheight(0) != 8
  1173. call LogResult(test_name, 'FAIL (1)')
  1174. return
  1175. endif
  1176. close
  1177. " use a specific height value
  1178. 15MRU
  1179. if winnr() != 2 || winheight(0) != 15
  1180. call LogResult(test_name, 'FAIL (2)')
  1181. return
  1182. endif
  1183. close
  1184. if v:version >= 800
  1185. " use a specific height value with a command modifier
  1186. topleft 12MRU
  1187. if winnr() != 1 || winheight(0) != 12
  1188. call LogResult(test_name, 'FAIL (3)')
  1189. return
  1190. endif
  1191. close
  1192. " check for the width (leftmost window)
  1193. vertical topleft 20MRU
  1194. if winnr() != 1 || winwidth(0) != 20
  1195. call LogResult(test_name, 'FAIL (4)')
  1196. return
  1197. endif
  1198. close
  1199. " check for the width (rightmost window)
  1200. vertical botright 25MRU
  1201. if winnr() != 2 || winwidth(0) != 25
  1202. call LogResult(test_name, 'FAIL (5)')
  1203. return
  1204. endif
  1205. close
  1206. endif
  1207. call LogResult(test_name, 'pass')
  1208. endfunc
  1209. " ==========================================================================
  1210. " Test47
  1211. " The height of the MRU window should be MRU_Window_Height
  1212. " ==========================================================================
  1213. func Test_47()
  1214. let test_name = 'test47'
  1215. only
  1216. " default height is 8
  1217. MRU
  1218. if winheight(0) != 8
  1219. call LogResult(test_name, 'FAIL (1)')
  1220. return
  1221. endif
  1222. close
  1223. let g:MRU_Window_Height = 2
  1224. MRU
  1225. if winheight(0) != 2
  1226. call LogResult(test_name, 'FAIL (2)')
  1227. return
  1228. endif
  1229. close
  1230. let g:MRU_Window_Height = 12
  1231. MRU
  1232. if winheight(0) != 12
  1233. call LogResult(test_name, 'FAIL (3)')
  1234. return
  1235. endif
  1236. close
  1237. call LogResult(test_name, 'pass')
  1238. let g:MRU_Window_Height = 8
  1239. endfunc
  1240. " ==========================================================================
  1241. " Test48
  1242. " Fuzzy search file names with MRU_FuzzyMatch set to 1.
  1243. " ==========================================================================
  1244. func Test_48()
  1245. if !exists('*matchfuzzy')
  1246. return
  1247. endif
  1248. let test_name = 'test48'
  1249. enew | only
  1250. let g:MRU_FuzzyMatch = 1
  1251. MRU F1
  1252. if fnamemodify(@%, ':p:t') ==# 'file1.txt' && winnr('$') == 1
  1253. call LogResult(test_name, 'pass')
  1254. else
  1255. call LogResult(test_name, 'FAIL (1)')
  1256. endif
  1257. let g:MRU_FuzzyMatch = 0
  1258. redir => msg
  1259. MRU F1
  1260. redir END
  1261. if msg =~# "MRU file list doesn't contain files matching F1"
  1262. call LogResult(test_name, 'pass')
  1263. else
  1264. call LogResult(test_name, 'FAIL (2)')
  1265. endif
  1266. let g:MRU_FuzzyMatch = 1
  1267. endfunc
  1268. " ==========================================================================
  1269. " Test49
  1270. " Test for creating a new file by saving an unnamed buffer.
  1271. " ==========================================================================
  1272. func Test_49()
  1273. let test_name = 'test49'
  1274. enew | only
  1275. call setline(1, 'sample file')
  1276. write sample.txt
  1277. let l = readfile(g:MRU_File)
  1278. if match(l, 'sample.txt') != -1
  1279. call LogResult(test_name, 'pass')
  1280. else
  1281. call LogResult(test_name, 'FAIL')
  1282. endif
  1283. call delete('sample.txt')
  1284. bwipe sample.txt
  1285. endfunc
  1286. " ==========================================================================
  1287. " Create the files used by the tests
  1288. call writefile(['MRU test file1'], 'file1.txt')
  1289. call writefile(['MRU test file2'], 'file2.txt')
  1290. call writefile(['MRU test file3'], 'file3.txt')
  1291. call writefile(['#include <stdio.h', 'int main(){}'], 'abc.c')
  1292. call writefile(['#include <stdlib.h', 'int main(){}'], 'def.c')
  1293. " Remove the results from the previous test runs
  1294. call delete('results.txt')
  1295. call delete(g:MRU_File)
  1296. " Generate a sorted list of Test_ functions to run
  1297. redir @q
  1298. silent function /^Test_
  1299. redir END
  1300. let s:tests = split(substitute(@q, '\(function\) \(\k*()\)', '\2', 'g'))
  1301. " Run the tests
  1302. set nomore
  1303. set debug=beep
  1304. for one_test in sort(s:tests)
  1305. exe 'call ' . one_test
  1306. endfor
  1307. set more
  1308. " TODO:
  1309. " Add the following tests:
  1310. " 1. When the MRU list is modified, the MRU menu should be refreshed.
  1311. " 2. Try to jump to an already open file from the MRU window and using the
  1312. " MRU command.
  1313. " Cleanup the files used by the tests
  1314. call delete('file1.txt')
  1315. call delete('file2.txt')
  1316. call delete('file3.txt')
  1317. call delete('abc.c')
  1318. call delete('def.c')
  1319. call delete(g:MRU_File)
  1320. " End of unit test execution
  1321. qall
  1322. " vim: shiftwidth=2 sts=2 expandtab