示例#1
0
        public void TestDefaultValueTemplateWithArg()
        {
            String templates =
                "t(a={x | 2*<x>}) ::= \"[<a>]\"" + newline;

            WriteFile(tmpdir, "t.stg", templates);
            STGroup group = new STGroupFile(Path.Combine(tmpdir, "t.stg"));
            String expected =
                "t(a={x | 2*<x>}) ::= <<" + newline +
                "[<a>]" + newline +
                ">>" + newline;
            String result = group.Show();
            Assert.AreEqual(expected, result);
        }
示例#2
0
        public void TestMultiTemplates()
        {
            String templates =
                "ta() ::= \"[<it>]\"" + newline +
                "duh() ::= <<hi there>>" + newline +
                "wow() ::= <<last>>" + newline;

            WriteFile(tmpdir, "t.stg", templates);
            STGroup group = new STGroupFile(Path.Combine(tmpdir, "t.stg"));
            String expected =
                "ta() ::= <<" + newline +
                "[<it>]" + newline +
                ">>" + newline +
                "duh() ::= <<" + newline +
                "hi there" + newline +
                ">>" + newline +
                "wow() ::= <<" + newline +
                "last" + newline +
                ">>" + newline;
            String result = group.Show();
            Assert.AreEqual(expected, result);
        }
示例#3
0
        public void TestSimpleGroup()
        {
            String templates =
                "t() ::= <<foo>>" + newline;

            WriteFile(tmpdir, "t.stg", templates);
            STGroup group = new STGroupFile(Path.Combine(tmpdir, "t.stg"));
            String expected =
                "t() ::= <<" + newline +
                "foo" + newline +
                ">>" + newline;
            String result = group.Show();
            Assert.AreEqual(expected, result);
        }
示例#4
0
        public void TestNestedTemplateInGroupFile()
        {
            String templates =
                "t(a) ::= \"<a:{x | <x:{<it>}>}>\"" + newline;

            WriteFile(tmpdir, "t.stg", templates);
            STGroup group = new STGroupFile(Path.Combine(tmpdir, "t.stg"));
            String expected =
                "t(a) ::= <<" + newline +
                "<a:{x | <x:{<it>}>}>" + newline +
                ">>" + newline;
            String result = group.Show();
            Assert.AreEqual(expected, result);
        }