Antlr4.Test.StringTemplate.TestCoreBasics.TestMapWithExprAsTemplateName C# (CSharp) Method

TestMapWithExprAsTemplateName() private method

private TestMapWithExprAsTemplateName ( ) : void
return void
        public void TestMapWithExprAsTemplateName()
        {
            string templates =
                "d ::= [\"foo\":\"bold\"]\n" +
                "test(name) ::= \"<name:(d.foo)()>\"\n" +
                "bold(x) ::= <<*<x>*>>\n";
            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            Template st = group.GetInstanceOf("test");
            st.Add("name", "Ter");
            st.Add("name", "Tom");
            st.Add("name", "Sumana");
            string expected = "*Ter**Tom**Sumana*";
            string result = st.Render();
            Assert.AreEqual(expected, result);
        }
TestCoreBasics