From 69dc54b407d14101e1ca6f8caafc44b10e074981 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Wed, 3 Apr 2024 04:37:44 +0200 Subject: [PATCH] Temporarily don't initialize runtime files in buffer test Adding InitRuntimeFiles() to buffer_test.go has changed the behavior of this test: now it tests not just buffer editing per se, but also how well buffer editing works together with syntax highlighting (since InitRuntimeFiles() loads syntax files, and many of the test buffers match the json header pattern in the json.yaml syntax file, so they are "highlighted" as json). This revealed long existing races between buffer editing and syntax highlighting. Until we fix those races, temporarily disable InitRuntimeFiles() in this test. --- internal/buffer/buffer_test.go | 4 +++- internal/config/rtfiles.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/buffer/buffer_test.go b/internal/buffer/buffer_test.go index 7d7602e4..dcfde610 100644 --- a/internal/buffer/buffer_test.go +++ b/internal/buffer/buffer_test.go @@ -20,7 +20,9 @@ type operation struct { func init() { ulua.L = lua.NewState() - config.InitRuntimeFiles(false) + // TODO: uncomment InitRuntimeFiles once we fix races between syntax + // highlighting and buffer editing. + // config.InitRuntimeFiles(false) config.InitGlobalSettings() config.GlobalSettings["backup"] = false config.GlobalSettings["fastdirty"] = true diff --git a/internal/config/rtfiles.go b/internal/config/rtfiles.go index 015a09b8..24adaebf 100644 --- a/internal/config/rtfiles.go +++ b/internal/config/rtfiles.go @@ -39,6 +39,10 @@ type RuntimeFile interface { var allFiles [][]RuntimeFile var realFiles [][]RuntimeFile +func init() { + initRuntimeVars() +} + func initRuntimeVars() { allFiles = make([][]RuntimeFile, NumTypes) realFiles = make([][]RuntimeFile, NumTypes)