Antlr4.Test.StringTemplate.TestCoreBasics.TestSetUnknownAttr C# (CSharp) Méthode

TestSetUnknownAttr() private méthode

private TestSetUnknownAttr ( ) : void
Résultat void
        public void TestSetUnknownAttr()
        {
            string templates =
                "t() ::= <<hi <name>!>>\n";
            ErrorBuffer errors = new ErrorBuffer();
            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            group.Listener = errors;
            Template st = group.GetInstanceOf("t");
            string result = null;
            try
            {
                st.Add("name", "Ter");
            }
            catch (ArgumentException iae)
            {
                result = iae.Message;
            }
            string expected = "no such attribute: name";
            Assert.AreEqual(expected, result);
        }
TestCoreBasics