comparison src/testdir/test_packadd.vim @ 29970:d891115c0aea v9.0.0323

patch 9.0.0323: using common name in tests leads to flaky tests Commit: https://github.com/vim/vim/commit/3b0d70f4ff436cb144683dafd956e8a3ee485a90 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 29 22:31:20 2022 +0100 patch 9.0.0323: using common name in tests leads to flaky tests Problem: Using common name in tests leads to flaky tests. Solution: Rename files and directories to be more specific.
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Aug 2022 23:45:04 +0200
parents b98c20b53a2d
children 457ea0570b6f
comparison
equal deleted inserted replaced
29969:5f2d38cacd6c 29970:d891115c0aea
1 " Tests for 'packpath' and :packadd 1 " Tests for 'packpath' and :packadd
2 2
3 source check.vim 3 source check.vim
4 4
5 func SetUp() 5 func SetUp()
6 let s:topdir = getcwd() . '/Xdir' 6 let s:topdir = getcwd() . '/Xppdir'
7 exe 'set packpath=' . s:topdir 7 exe 'set packpath=' . s:topdir
8 let s:plugdir = s:topdir . '/pack/mine/opt/mytest' 8 let s:plugdir = s:topdir . '/pack/mine/opt/mytest'
9 endfunc 9 endfunc
10 10
11 func TearDown() 11 func TearDown()
49 49
50 call assert_equal(42, g:plugin_works) 50 call assert_equal(42, g:plugin_works)
51 call assert_equal(77, g:plugin_also_works) 51 call assert_equal(77, g:plugin_also_works)
52 call assert_equal(17, g:ftdetect_works) 52 call assert_equal(17, g:ftdetect_works)
53 call assert_true(len(&rtp) > len(rtp)) 53 call assert_true(len(&rtp) > len(rtp))
54 call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) 54 call assert_match('/testdir/Xppdir/pack/mine/opt/mytest\($\|,\)', &rtp)
55 55
56 let new_after = match(&rtp, '/testdir/Xdir/pack/mine/opt/mytest/after,') 56 let new_after = match(&rtp, '/testdir/Xppdir/pack/mine/opt/mytest/after,')
57 let forwarded = substitute(first_after_entry, '\\', '[/\\\\]', 'g') 57 let forwarded = substitute(first_after_entry, '\\', '[/\\\\]', 'g')
58 let old_after = match(&rtp, ',' . forwarded . '\>') 58 let old_after = match(&rtp, ',' . forwarded . '\>')
59 call assert_true(new_after > 0, 'rtp is ' . &rtp) 59 call assert_true(new_after > 0, 'rtp is ' . &rtp)
60 call assert_true(old_after > 0, 'match ' . forwarded . ' in ' . &rtp) 60 call assert_true(old_after > 0, 'match ' . forwarded . ' in ' . &rtp)
61 call assert_true(new_after < old_after, 'rtp is ' . &rtp) 61 call assert_true(new_after < old_after, 'rtp is ' . &rtp)
65 let rtp = &rtp 65 let rtp = &rtp
66 packadd myte 66 packadd myte
67 67
68 " Check the path of 'myte' is added 68 " Check the path of 'myte' is added
69 call assert_true(len(&rtp) > len(rtp)) 69 call assert_true(len(&rtp) > len(rtp))
70 call assert_match('/testdir/Xdir/pack/mine/opt/myte\($\|,\)', &rtp) 70 call assert_match('/testdir/Xppdir/pack/mine/opt/myte\($\|,\)', &rtp)
71 71
72 " Check exception 72 " Check exception
73 call assert_fails("packadd directorynotfound", 'E919:') 73 call assert_fails("packadd directorynotfound", 'E919:')
74 call assert_fails("packadd", 'E471:') 74 call assert_fails("packadd", 'E471:')
75 endfunc 75 endfunc
87 87
88 packadd other 88 packadd other
89 89
90 call assert_equal(24, g:plugin_works) 90 call assert_equal(24, g:plugin_works)
91 call assert_true(len(&rtp) > len(rtp)) 91 call assert_true(len(&rtp) > len(rtp))
92 call assert_match('/testdir/Xdir/pack/mine/start/other\($\|,\)', &rtp) 92 call assert_match('/testdir/Xppdir/pack/mine/start/other\($\|,\)', &rtp)
93 endfunc 93 endfunc
94 94
95 func Test_packadd_noload() 95 func Test_packadd_noload()
96 call mkdir(s:plugdir . '/plugin', 'p') 96 call mkdir(s:plugdir . '/plugin', 'p')
97 call mkdir(s:plugdir . '/syntax', 'p') 97 call mkdir(s:plugdir . '/syntax', 'p')
104 let g:plugin_works = 0 104 let g:plugin_works = 0
105 105
106 packadd! mytest 106 packadd! mytest
107 107
108 call assert_true(len(&rtp) > len(rtp)) 108 call assert_true(len(&rtp) > len(rtp))
109 call assert_match('testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) 109 call assert_match('testdir/Xppdir/pack/mine/opt/mytest\($\|,\)', &rtp)
110 call assert_equal(0, g:plugin_works) 110 call assert_equal(0, g:plugin_works)
111 111
112 " check the path is not added twice 112 " check the path is not added twice
113 let new_rtp = &rtp 113 let new_rtp = &rtp
114 packadd! mytest 114 packadd! mytest