Skip to content

Commit 36c314d

Browse files
committed
Add test that tries loading the script twice
1 parent aaa35b1 commit 36c314d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

plugin/strip_trailing_whitespace.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let s:save_cpo = &cpo | set cpo&vim
33

44
" Only load the plugin once
55
if exists('g:loaded_strip_trailing_whitespace')
6-
finish
6+
finish
77
endif
88
let g:loaded_strip_trailing_whitespace = 1
99

runtest.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
let s:has_errors = 0
22

33
try
4-
let s:scriptdir = fnamemodify(resolve(expand('<sfile>:p')), ':h')
5-
execute 'source' s:scriptdir .. '/plugin/strip_trailing_whitespace.vim'
4+
execute 'cd' fnamemodify(resolve(expand('<sfile>:p')), ':h')
5+
execute 'source' 'plugin/strip_trailing_whitespace.vim'
66

7-
let s:testfiles = glob(s:scriptdir .. '/test/*.vim', 1, 1)
7+
let s:testfiles = glob('test/*.vim', 1, 1)
88
for s:testfile in s:testfiles
99
execute 'source' s:testfile
1010

test/test.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,7 @@ function Test_HandleManyLinesWithTWS() abort
7474
endfunction
7575
call s:TestEdits(['line '], function('s:EditCb'), extend(['line'], repeat([''], 100)))
7676
endfunction
77+
78+
function Test_LoadScriptTwice() abort
79+
source plugin/strip_trailing_whitespace.vim
80+
endfunction

0 commit comments

Comments
 (0)