Antlr4.Test.StringTemplate.TestDictionaries.TestDictKeyLookupViaTemplate C# (CSharp) Method

TestDictKeyLookupViaTemplate() private method

private TestDictKeyLookupViaTemplate ( ) : void
return void
        public void TestDictKeyLookupViaTemplate()
        {
            // Make sure we try rendering stuff to string if not found as regular object
            string templates =
                    "typeInit ::= [\"int\":{0<w>}, \"float\":{0.0<w>}] " + newline +
                    "var(type,w,name) ::= \"<type> <name> = <typeInit.(type)>;\"" + newline
                    ;
            writeFile(tmpdir, "test.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "test.stg"));
            Template st = group.GetInstanceOf("var");
            st.Add("w", "L");
            st.Add("type", new Template("int"));
            st.Add("name", "x");
            string expecting = "int x = 0L;";
            string result = st.Render();
            Assert.AreEqual(expecting, result);
        }