コード例 #1
0
        public void TestIndentation()
        {
            var Output = new IndentedStringBuilder();

            Output.Write("{\n");
            Output.Indent(() =>
            {
                Output.Write("Hello World!\n");
                Output.Write("Goodbye World!\n");
            });
            Output.Write("}\n");
            Assert.AreEqual(
                @"{\n" +
                @"    Hello World!\n" +
                @"    Goodbye World!\n" +
                @"}\n",
                AstStringUtils.ToLiteralRaw(Output.ToString())
                );
        }
コード例 #2
0
        public void TestIndentation()
        {
            var output = new IndentedStringBuilder();

            output.Write("{");
            output.WriteNewLine();
            output.Indent(() =>
            {
                output.Write("Hello World!");
                output.WriteNewLine();
                output.Write("Goodbye World!");
                output.WriteNewLine();
            });
            output.Write("}");
            output.WriteNewLine();
            Assert.Equal(
                @"{\n" +
                @"    Hello World!\n" +
                @"    Goodbye World!\n" +
                @"}\n",
                AstStringUtils.ToLiteralRaw(output.ToString())
                );
        }