private void CheckForErrors() { if (VimErrorDetector.HasErrors()) { var message = FormatException(VimErrorDetector.GetErrors()); throw new Exception(message); } }
public virtual void Dispose() { if (_vimErrorDetector.HasErrors()) { var msg = String.Format("Extension Exception: {0}", _vimErrorDetector.GetErrors().First().Message); throw new Exception(msg); } _vimErrorDetector.Clear(); _vim.VimData.SearchHistory.Clear(); _vim.VimData.CommandHistory.Clear(); _vim.VimData.LastCommand = FSharpOption <StoredCommand> .None; _vim.VimData.LastShellCommand = FSharpOption <string> .None; _vim.KeyMap.ClearAll(); _vim.MarkMap.ClearGlobalMarks(); _vim.CloseAllVimBuffers(); // Reset all of the global settings back to their default values. Adds quite // a bit of sanity to the test bed foreach (var setting in _vim.GlobalSettings.AllSettings) { if (!setting.IsValueDefault && !setting.IsValueCalculated) { _vim.GlobalSettings.TrySetValue(setting.Name, setting.DefaultValue); } } // Reset all of the register values to empty foreach (var name in _vim.RegisterMap.RegisterNames) { _vim.RegisterMap.GetRegister(name).UpdateValue(""); } // Don't let recording persist across tests if (_vim.MacroRecorder.IsRecording) { _vim.MacroRecorder.StopRecording(); } var vimHost = Vim.VimHost as MockVimHost; if (vimHost != null) { vimHost.Clear(); } VariableMap.Clear(); }
public virtual void Dispose() { _vim.MarkMap.Clear(); if (_vimErrorDetector.HasErrors()) { var msg = String.Format("Extension Exception: {0}", _vimErrorDetector.GetErrors().First().Message); // Need to clear before we throw or every subsequent test will fail with the same error _vimErrorDetector.Clear(); throw new Exception(msg); } _vimErrorDetector.Clear(); _vim.VimData.SearchHistory.Reset(); _vim.VimData.CommandHistory.Reset(); _vim.VimData.LastCommand = FSharpOption <StoredCommand> .None; _vim.VimData.LastShellCommand = FSharpOption <string> .None; _vim.VimData.AutoCommands = FSharpList <AutoCommand> .Empty; _vim.VimData.AutoCommandGroups = FSharpList <AutoCommandGroup> .Empty; _vim.KeyMap.ClearAll(); _vim.KeyMap.IsZeroMappingEnabled = true; _vim.CloseAllVimBuffers(); _vim.IsDisabled = false; // The majority of tests run without a VimRc file but a few do customize it for specific // test reasons. Make sure it's consistent VimRcState = VimRcState.None; // Reset all of the global settings back to their default values. Adds quite // a bit of sanity to the test bed foreach (var setting in _vim.GlobalSettings.AllSettings) { if (!setting.IsValueDefault && !setting.IsValueCalculated) { _vim.GlobalSettings.TrySetValue(setting.Name, setting.DefaultValue); } } // Reset all of the register values to empty foreach (var name in _vim.RegisterMap.RegisterNames) { _vim.RegisterMap.GetRegister(name).UpdateValue(""); } // Don't let recording persist across tests if (_vim.MacroRecorder.IsRecording) { _vim.MacroRecorder.StopRecording(); } var vimHost = Vim.VimHost as MockVimHost; if (vimHost != null) { vimHost.ShouldCreateVimBufferImpl = false; vimHost.Clear(); } VariableMap.Clear(); }