Antlr4.Test.StringTemplate.TestDollarDelimiters.TestDefaultArgument C# (CSharp) Méthode

TestDefaultArgument() private méthode

private TestDefaultArgument ( ) : void
Résultat void
        public void TestDefaultArgument()
        {
            string templates =
                    "method(name) ::= <<" + newline +
                    "$stat(name)$" + newline +
                    ">>" + newline +
                    "stat(name,value=\"99\") ::= \"x=$value$; // $name$\"" + newline
                    ;
            writeFile(tmpdir, "group.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "group.stg"), '$', '$');
            Template b = group.GetInstanceOf("method");
            b.Add("name", "foo");
            string expecting = "x=99; // foo";
            string result = b.Render();
            Assert.AreEqual(expecting, result);
        }