Commits

ZyX_I committed 00f7cf7

Fixed [un]loadplugin functions, added invalid-unload-self test

Comments (0)

Files changed (3)

plugin/frawor.vim

     endif
     let d={}
     let deps=copy(a:dependencies)
+    "▶4 Adding frawor to dependencies
     if has_key(s:g, '_frawor')
         if !has_key(deps, s:g._frawor.id)
             let deps[s:g._frawor.id]=s:g.pls[s:g._frawor.id].version
     else
         let deps[plid]=plversion
     endif
+    "▲4
     for [dplid, d.Version] in items(deps)
         "▶4 Verifying dependency version
         if type(d.Version)!=type([])
         endif
         let s:g.dependents[dplid][plid]=1
     endfor
-    lockvar! plugdict.dependencies
     "▶2 Locking plugdict
     lockvar 1 plugdict
     lockvar plugdict.version
+    lockvar! plugdict.dependencies
     unlockvar plugdict.features
     unlockvar plugdict.status
     "▶2 Constructing returned dictionary
         endif
         let plugdict=s:g.pls[a:plid]
     elseif type(a:plid)==type({})
-        if has_key(a:plid, 'id') && type(a:plid.id)==type("") ||
+        if has_key(a:plid, 'id') && type(a:plid.id)==type("") &&
                     \s:g.pls[a:plid.id] is a:plid
             let plugdict=a:plid
         else
-            call s:F._frawor.throw('inva:plid')
+            call s:F._frawor.throw('invplugdict')
         endif
     else
         call s:F._frawor.throw('invloadarg')
             call s:F._frawor.throw('notloaded', a:plid)
         endif
     elseif type(a:plid)==type({})
-        if has_key(a:plid, 'id') && type(a:plid.id)==type("") ||
+        if has_key(a:plid, 'id') && type(a:plid.id)==type("") &&
                     \s:g.pls[a:plid.id] is a:plid
             let plugdict=a:plid
         else
-            call s:F._frawor.throw('inva:plid')
+            call s:F._frawor.throw('invplugdict')
         endif
     else
         call s:F._frawor.throw('invunloadarg')

test/invalid-unload-self.in

+:let &rtp.=",".escape($TESTDIR, ',\').'/rtp'
+:let g:testfile="plugin/invalid-unload-self.vim"
+:source test.vim

test/rtp/plugin/invalid-unload-self.vim

+execute frawor#Setup('0.0', {}, 1)
+call FraworUnload({'id': 'plugin/invalid-unload-self'})
+