Skip to content

Commit d67ce73

Browse files
committed
Don't initialize plugins in buffer test and rtfiles test
Adding InitPlugins() to tests has caused noisy error logs when running the buffer_test.go test (although the test result is still PASS): 2024/03/23 15:14:30 Plugin does not exist: autoclose at autoclose : &{autoclose autoclose <nil> [runtime/plugins/autoclose/autoclose.lua] false true} 2024/03/23 15:14:30 Plugin does not exist: comment at comment : &{comment comment <nil> [runtime/plugins/comment/comment.lua] false true} 2024/03/23 15:14:30 Plugin does not exist: diff at diff : &{diff diff <nil> [runtime/plugins/diff/diff.lua] false true} 2024/03/23 15:14:30 Plugin does not exist: ftoptions at ftoptions : &{ftoptions ftoptions <nil> [runtime/plugins/ftoptions/ftoptions.lua] false true} ... These errors are caused simply by the fact that plugins are initialized but not loaded. Adding config.LoadAllPlugins() to buffer_test.go "fixes" this problem. However, at the moment it doesn't seem a good idea to load plugins in buffer_test.go, since buffer_test.go doesn't properly initialize Lua. It only does ulua.L = lua.NewState() but doesn't do the other stuff that init() in cmd/micro/initlua.go does. As a result, plugins will not be able to do anything correctly. So in order to initialize Lua correctly we need to be inside cmd/micro/, so we cannot do it in buffer_test.go or any other tests except micro_test.go.
1 parent 828871a commit d67ce73

File tree

2 files changed

+0
-2
lines changed

2 files changed

+0
-2
lines changed

internal/buffer/buffer_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ type operation struct {
2121
func init() {
2222
ulua.L = lua.NewState()
2323
config.InitRuntimeFiles()
24-
config.InitPlugins()
2524
config.InitGlobalSettings()
2625
config.GlobalSettings["backup"] = false
2726
config.GlobalSettings["fastdirty"] = true

internal/config/rtfiles_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
func init() {
1010
InitRuntimeFiles()
11-
InitPlugins()
1211
}
1312

1413
func TestAddFile(t *testing.T) {

0 commit comments

Comments
 (0)