Commits

ZyX_I  committed 737328f

Fixed getdeps and getordereddeps, updated tests, made tests use FraworLoad by default

  • Participants
  • Parent commits c9ddc27

Comments (0)

Files changed (5)

File plugin/frawor.vim

 "▶1 getdeps
 function s:F.getdeps(plugdict, hasdep)
     let r=[a:plugdict]
-    for dplugdict in map(keys(a:plugdict.dependencies), 's:g.pls[v:val]')
+    for dplugdict in map(keys(get(s:g.dependents, a:plugdict.id, {})),
+                \        's:g.pls[v:val]')
         if !has_key(a:hasdep, dplugdict.id)
             let a:hasdep[dplugdict.id]=1
             let r+=s:F.getdeps(dplugdict, a:hasdep)
                 \   (0)))
 endfunction
 let s:F._functions['s:DepComp']=function('s:DepComp')
-"▶1 getorderegdeps
-function s:F.getorderegdeps(plugdict)
+"▶1 getordereddeps
+function s:F.getordereddeps(plugdict)
     let deps=sort(s:F.getdeps(a:plugdict, {}), s:F._functions['s:DepComp'])
     let ordered=[]
     let withdeps=[]
     call map(deps, 'add(((empty(get(s:g.dependents, v:val.id, {})))?'.
                 \           '(ordered):'.
                 \           '(withdeps)), '.
-                \      'dplugdict)')
+                \      'v:val)')
     let orderedids=map(copy(ordered), 'v:val.id')
     unlet deps
     while !empty(withdeps)
     endif
     "▲2
     if plugdict.status!=0
-        let ordered=s:F.getorderegdeps(plugdict)
+        let ordered=s:F.getordereddeps(plugdict)
         let tosource=map(reverse(copy(ordered)), 'v:val.file')
         " XXX runfeature returns v:val
         call map(ordered, 's:F.runfeatures(v:val, "unloadpre")')

File test/double-registration.in

 :let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
 :let g:testfile="plugin/double-registration.vim"
+:let g:testcmd='runtime!'
 :source test.vim
 :source test.vim

File test/ignoredeps-feature.ok

+load: plugin/frawor/functions
 load: plugin/frawor
 load: plugin/writefile-feature
 load: plugin/ignoredeps-feature

File test/rtp/plugin/writefile-feature.vim

-execute frawor#Setup('0.0', {'plugin/writefile-feature': '0'}, 1)
+execute frawor#Setup('0.0', {}, 1)
 function s:F.writefile(plugdict, ...)
     let r=[]
     if filereadable(g:outfile)

File test/test.vim

 let g:outfile=g:curtest.'.out'
 if !exists('g:testcmd')
-    let g:testcmd='runtime!'
+    let s:testcmd='call FraworLoad(g:testfile[:-5])'
+else
+    let s:testcmd=g:testcmd.' '.fnameescape(g:testfile)
 endif
 try
-    execute g:testcmd fnameescape(g:testfile)
+    execute s:testcmd
 catch
     let r=[substitute(v:exception,
                 \'Frawor:\%(\\.\|[^:]\)\+:\%(\\.\|[^:]\)\+\zs:.*', '', '')]