/// <summary>
        /// Parses wikitext, and asserts
        /// 1. Whether the parsed AST can be converted back to the same wikitext as input.
        /// 2. Whether the parsed AST is correct.
        /// </summary>
        public Wikitext ParseAndAssert(string text, string expectedDump, WikitextParserOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            var parser = new WikitextParser {
                Options = options
            };
            var root       = parser.Parse(text);
            var parsedText = root.ToString();

            Output.WriteLine("Original Text\n====================");
            Output.WriteLine(text);
            Output.WriteLine("Parsed Text\n====================");
            Output.WriteLine(parsedText);
            var rootExpr = Utility.Dump(root);

            Output.WriteLine("AST Dump\n====================");
            Output.WriteLine(EscapeString(rootExpr));
            if (expectedDump != rootExpr)
            {
                Assert.Equal(EscapeString(expectedDump), EscapeString(rootExpr));
            }
            if (!options.AllowClosingMarkInference)
            {
                Assert.Equal(text, parsedText);
            }
            return(root);
        }
        public void TestMethod2()
        {
            var options = new WikitextParserOptions
            {
                AllowClosingMarkInference = true
            };
            var root = ParseAndAssert("{{Test{{test|a|b|c}}|def|g=h",
                                      "P[{{Test{{test|a|b|c}}|P[def]|P[g]=P[h]}}]",
                                      options);

            Assert.True(((IWikitextParsingInfo)root.Lines.FirstNode.EnumChildren().First()).InferredClosingMark);
            root = ParseAndAssert("<div><a>test</a><tag>def</div>",
                                  "P[<div>P[<a>P[test]</a><tag>P[def]</tag>]</div>]",
                                  options);
            Assert.True(((IWikitextParsingInfo)root.EnumDescendants().OfType <TagNode>().First(n => n.Name == "tag"))
                        .InferredClosingMark);
            root = ParseAndAssert("<div><a>test</a><tag>def{{test|</div>",
                                  "P[<div>P[<a>P[test]</a><tag>P[def{{test|P[$</div$>]}}]</tag>]</div>]",
                                  options);
            Assert.True(((IWikitextParsingInfo)root.EnumDescendants().OfType <TagNode>().First(n => n.Name == "tag"))
                        .InferredClosingMark);
        }