Skip to content

Commit 825cdc5

Browse files
committed
Vitalizer: add test for non-module files
1 parent ab8c764 commit 825cdc5

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

test/.themisrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ let g:testplugin_name = 'testplugin'
1414
let g:testplugin_root = g:root . '/test/_testdata/vital/' . g:testplugin_name . '/'
1515
let g:cyclic_module_root = g:root . '/test/_testdata/vital/cyclic/'
1616
let g:symlinkplugin_root = g:root . '/test/_testdata/vital/symlink_root/symlink/'
17+
let g:datafile_module_root = g:root . '/test/_testdata/vital/datatest/'
1718
call themis#option('runtimepath', g:testplugin_root)
1819
call themis#option('runtimepath', g:cyclic_module_root)
1920
call themis#option('runtimepath', g:symlinkplugin_root)
21+
call themis#option('runtimepath', g:datafile_module_root)
2022

2123
if $THEMIS_PROFILE !=# ''
2224
execute 'profile' 'start' $THEMIS_PROFILE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test Data
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function! s:_vital_loaded(V) abort
2+
let s:V = a:V
3+
endfunction
4+
5+
function! s:_vital_depends() abort
6+
return {'modules':[], 'files':['DataTest.txt']}
7+
endfunction
8+
9+
function! s:dummy() abort
10+
return 0
11+
endfunction
12+

test/vital.vimspec

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Describe vital
66
let Filepath = Vital.import('System.Filepath')
77
let Prelude = Vital.import('Prelude')
88

9-
let vitalize_modules = ['Data.List', 'Data.LazyList', 'Data.String', 'Web.JSON', 'Cyclic1']
9+
let vitalize_modules = ['Data.List', 'Data.LazyList', 'Data.String', 'Web.JSON', 'Cyclic1', 'DataTest']
1010
call vitalizer#vitalize(g:testplugin_name, g:testplugin_root, vitalize_modules, '')
1111
End
1212

@@ -177,6 +177,7 @@ Describe vital
177177
Assert NotEmpty(vital#vital#import('Data.List'))
178178
Assert NotEmpty(vital#vital#import('Selfmodule'))
179179
Assert NotEmpty(vital#vital#import('Cyclic1'))
180+
Assert NotEmpty(vital#vital#import('DataTest'))
180181
End
181182
End
182183

@@ -238,6 +239,10 @@ Describe vital
238239
Assert True(V.import('Cyclic1').return1())
239240
End
240241

242+
It supports datafile dependencies
243+
Assert True(1 == len(readfile(Filepath.join(g:testplugin_root, 'autoload/vital/' . '_' . g:testplugin_name . '/DataTest.txt'))))
244+
End
245+
241246
Context wildignore handling
242247
Before all
243248
set wildignore+=*.vim
@@ -274,6 +279,7 @@ Describe vital
274279
Assert NotEmpty(V.import('Data.List'))
275280
Assert NotEmpty(V.import('Selfmodule'))
276281
Assert NotEmpty(V.import('Cyclic1'))
282+
Assert NotEmpty(V.import('DataTest'))
277283
End
278284
End
279285
End
@@ -313,6 +319,10 @@ Describe vital
313319
Assert True(V.Cyclic1.return1())
314320
End
315321

322+
It supports datafile dependencies
323+
Assert True(1 == len(readfile(Filepath.join(g:testplugin_root, 'autoload/vital/' . '_' . g:testplugin_name . '/DataTest.txt'))))
324+
End
325+
316326
Context wildignore handling
317327
Before all
318328
set wildignore+=*.vim

0 commit comments

Comments
 (0)