public PrettyPrintOptions( NewlineOption newlineOption, IndentKindOption indentKindOption, long indentSize, bool insertFinalNewLine) { this.NewlineOption = newlineOption; this.IndentKindOption = indentKindOption; this.IndentSize = (int)Math.Min(MaxIndentSize, Math.Max(MinIndentSize, indentSize)); this.InsertFinalNewline = insertFinalNewLine; }
public void PrintProgram_NewLineOptionNotAuto_ShouldUseSpecifiedNewline(NewlineOption newlineOption, string originalNewline, string expectedNewline) => this.TestPrintProgram( string.Join(originalNewline, new[] { "var foo = bar", "var bar = foo", "var baz = bar" }), string.Join(expectedNewline, new[] { "var foo = bar", "var bar = foo", "var baz = bar" }), new PrettyPrintOptions(newlineOption, IndentKindOption.Space, 2, false));
public void PrintProgram_NewLineOptionNotAuto_ShouldUseSpecifiedNewline(NewlineOption newlineOption, string originalNewline, string expectedNewline) { var programSyntax = ParserHelper.Parse(string.Join(originalNewline, new[] { "var foo = bar", "var bar = foo", "var baz = bar" })); var options = new PrettyPrintOptions(newlineOption, IndentKindOption.Space, 2, false); var output = PrettyPrinter.PrintProgram(programSyntax, options); output.Should().Be(string.Join(expectedNewline, new[] { "var foo = bar", "var bar = foo", "var baz = bar" })); }