public void VerticalSpacing_IgnoredWithIndentProcedureExtraSpacing() { string expected; var input = expected = @"Private Sub TestOne() End Sub Private Sub TestTwo() End Sub Private Sub TestThree() End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(input, out var component, new Selection(3, 5, 3, 5)); using (var state = MockParser.CreateAndParse(vbe.Object)) { var indenter = new Indenter(vbe.Object, () => { var s = IndenterSettingsTests.GetMockIndenterSettings(); s.VerticallySpaceProcedures = true; s.LinesBetweenProcedures = 1; return(s); }); var indentCommand = MockIndenter.ArrangeIndentCurrentProcedureCommand(vbe, indenter, state); indentCommand.Execute(null); Assert.AreEqual(expected, component.CodeModule.Content()); } }
public void VerticalSpacing_IndentProcedureDoesntRemoveSurroundingWhitespace() { const string inputCode = @"Type Foo Bar As Long End Type Function TestFunction() As Long TestFunction = 42 End Function Sub TestSub() End Sub"; const string expectedCode = @"Type Foo Bar As Long End Type Function TestFunction() As Long TestFunction = 42 End Function Sub TestSub() End Sub"; var vbe = MockVbeBuilder.BuildFromSingleStandardModule(inputCode, out var component, new Selection(6, 1)); using (var state = MockParser.CreateAndParse(vbe.Object)) { var indentCommand = MockIndenter.ArrangeIndentCurrentProcedureCommand(vbe, new Indenter(vbe.Object, () => IndenterSettingsTests.GetMockIndenterSettings()), state); indentCommand.Execute(null); Assert.AreEqual(expectedCode, component.CodeModule.Content()); } }