コード例 #1
0
        protected override MessageHolder Test(Mode mode, int parseErrors, string expected, params LNode[] inputs)
        {
            var messages = new MessageHolder();
            var options  = new Les2PrinterOptions {
                IndentString = "  "
            };

            if (parseErrors == 0)
            {
                if (mode == Mode.Exact)
                {
                    var result = Les2LanguageService.Value.Print(inputs, messages, ParsingMode.Statements, options);
                    Assert.AreEqual(expected, result);
                }
                else
                {
                    // Start by parsing. If parsing fails, just stop; such errors are
                    // already reported by LesParserTests so we need not report them here.
                    var _ = Les2LanguageService.Value.Parse(expected, msgs: messages);
                    if (messages.List.All(msg => msg.Severity < Severity.Error))
                    {
                        foreach (LNode input in inputs)
                        {
                            DoPrinterTest(input);
                        }
                    }
                }
            }
            return(messages);
        }
コード例 #2
0
ファイル: Les2Printer.cs プロジェクト: saisirisha1835/ecsharp
 public void SetOptions(ILNodePrinterOptions options)
 {
     _o = options as Les2PrinterOptions ?? new Les2PrinterOptions(options);
 }