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

TestStringsInDictionary() private method

private TestStringsInDictionary ( ) : void
return void
        public void TestStringsInDictionary()
        {
            string templates =
                "auxMap ::= [\n" +
                "   \"E\": \"electric <field>\",\n" +
                "   \"I\": \"in <field> between\",\n" +
                "   \"F\": \"<field> force\",\n" +
                "   default: \"<field>\"\n" +
                "]\n" +
                "\n" +
                "makeTmpl(type, field) ::= <<\n" +
                "<auxMap.(type)>\n" +
                ">>\n" +
                "\n" +
                "top() ::= <<\n" +
                "  <makeTmpl(\"E\", \"foo\")>\n" +
                "  <makeTmpl(\"F\", \"foo\")>\n" +
                "  <makeTmpl(\"I\", \"foo\")>\n" +
                ">>\n";
            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(tmpdir + Path.DirectorySeparatorChar + "t.stg");
            Template st = group.GetInstanceOf("top");
            Assert.IsNotNull(st);
            string expecting =
                "  electric <field>" + newline +
                "  <field> force" + newline +
                "  in <field> between";
            Assert.AreEqual(expecting, st.Render());
        }