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

TestDictNullKeyGetsDefaultValue() private method

private TestDictNullKeyGetsDefaultValue ( ) : void
return void
        public void TestDictNullKeyGetsDefaultValue()
        {
            string templates =
                    "typeInit ::= [\"int\":\"0\", default:\"null\"] " + newline +
                    "var(type,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");
            // missing or set to null: st.Add("type", null);
            st.Add("name", "x");
            string expecting = " x = null;";
            string result = st.Render();
            Assert.AreEqual(expecting, result);
        }