Antlr4.Test.StringTemplate.TestImports.TestImportGroupFileSameDir C# (CSharp) Method

TestImportGroupFileSameDir() private method

private TestImportGroupFileSameDir ( ) : void
return void
        public void TestImportGroupFileSameDir()
        {
            /*
            dir
                group1.stg		that imports group2.stg in same dir with just filename
                group2.stg		has c()
             */
            string dir = tmpdir;
            string groupFile =
                "import \"group2.stg\"\n" +
                "a() ::= \"g1 a\"\n" +
                "b() ::= \"<c()>\"\n";
            writeFile(dir, "group1.stg", groupFile);

            groupFile =
                "c() ::= \"g2 c\"\n";
            writeFile(dir, "group2.stg", groupFile);

            TemplateGroup group1 = new TemplateGroupFile(Path.Combine(dir, "group1.stg"));
            Template st = group1.GetInstanceOf("c"); // should see c()
            string expected = "g2 c";
            string result = st?.Render();
            Assert.AreEqual(expected, result);
        }