public void TestGetVariableTypes() { TestVariableMapSetup(); mVariableMap.CreateVariable("name1", "type1", "id1"); mVariableMap.CreateVariable("name2", "type1", "id2"); mVariableMap.CreateVariable("name3", "type2", "id3"); mVariableMap.CreateVariable("name4", "type3", "id4"); TestHelper.IsEqualArrays(new[] { "type1", "type2", "type3" }, mVariableMap.GetVariableTypes().ToArray()); //get variable types none---------------------------------------------------- mVariableMap.Clear(); TestHelper.IsEqualArrays(new string[] { }, mVariableMap.GetVariableTypes().ToArray()); //--------------------------------------------------------------------------- TestVariableMapTearDown(); }
private void ResetState() { Vim.MarkMap.Clear(); Vim.VimData.SearchHistory.Reset(); Vim.VimData.CommandHistory.Reset(); Vim.VimData.LastCommand = FSharpOption <StoredCommand> .None; Vim.VimData.LastCommandLine = ""; Vim.VimData.LastShellCommand = FSharpOption <string> .None; Vim.VimData.LastTextInsert = 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.Settings) { 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(); } if (Vim.VimHost is MockVimHost vimHost) { vimHost.ShouldCreateVimBufferImpl = false; vimHost.Clear(); } VariableMap.Clear(); VimErrorDetector.Clear(); TestableSynchronizationContext?.Dispose(); TestableSynchronizationContext = null; }
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(); }