Show() public method

public Show ( ) : string
return string
Example #1
0
        public void TestSimpleGroup()
        {
            string templates =
                "t() ::= <<foo>>" + Environment.NewLine;

            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            string expected =
                "t() ::= <<" + Environment.NewLine +
                "foo" + Environment.NewLine +
                ">>" + Environment.NewLine;
            string result = group.Show();
            Assert.AreEqual(expected, result);
        }
Example #2
0
        public void TestSingleTemplateWithArgs()
        {
            string templates =
                "t(a,b) ::= \"[<a>]\"" + Environment.NewLine;

            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            string expected =
                "t(a,b) ::= <<" + Environment.NewLine +
                "[<a>]" + Environment.NewLine +
                ">>" + Environment.NewLine;
            string result = group.Show();
            Assert.AreEqual(expected, result);
        }
Example #3
0
        public void TestNestedTemplateInGroupFile()
        {
            string templates =
                "t(a) ::= \"<a:{x | <x:{y | <y>}>}>\"" + Environment.NewLine;

            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            string expected =
                "t(a) ::= <<" + Environment.NewLine +
                "<a:{x | <x:{y | <y>}>}>" + Environment.NewLine +
                ">>" + Environment.NewLine;
            string result = group.Show();
            Assert.AreEqual(expected, result);
        }
Example #4
0
        public void TestNestedDefaultValueTemplateWithEscapes()
        {
            string templates =
                "t(a={x | \\< <x:{y|<y>\\}}>}) ::= \"[<a>]\"" + Environment.NewLine;

            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            string expected =
                "t(a={x | \\< <x:{y|<y>\\}}>}) ::= <<" + Environment.NewLine +
                "[<a>]" + Environment.NewLine +
                ">>" + Environment.NewLine;
            string result = group.Show();
            Assert.AreEqual(expected, result);
        }
Example #5
0
        public void TestMultiTemplates()
        {
            string templates =
                "ta(x) ::= \"[<x>]\"" + Environment.NewLine +
                "duh() ::= <<hi there>>" + Environment.NewLine +
                "wow() ::= <<last>>" + Environment.NewLine;

            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            string expected =
                "ta(x) ::= <<" + Environment.NewLine +
                "[<x>]" + Environment.NewLine +
                ">>" + Environment.NewLine +
                "duh() ::= <<" + Environment.NewLine +
                "hi there" + Environment.NewLine +
                ">>" + Environment.NewLine +
                "wow() ::= <<" + Environment.NewLine +
                "last" + Environment.NewLine +
                ">>" + Environment.NewLine;
            string result = group.Show();
            Assert.AreEqual(expected, result);
        }
Example #6
0
        public void TestEscapedQuote()
        {
            // setTest(ranges) ::= "<ranges; separator=\"||\">"
            // has to unescape the strings.
            string templates =
                "setTest(ranges) ::= \"<ranges; separator=\\\"||\\\">\"" + Environment.NewLine;

            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            string expected =
                "setTest(ranges) ::= <<" + Environment.NewLine +
                "<ranges; separator=\"||\">" + Environment.NewLine +
                ">>" + Environment.NewLine;
            string result = group.Show();
            Assert.AreEqual(expected, result);
        }
Example #7
0
        public void TestDefaultValues2()
        {
            string templates =
                "t(x, y, a={def1}, b=\"def2\") ::= \"[<a>]\"" + Environment.NewLine;

            writeFile(tmpdir, "t.stg", templates);
            TemplateGroup group = new TemplateGroupFile(Path.Combine(tmpdir, "t.stg"));
            string expected =
                "t(x,y,a={def1},b=\"def2\") ::= <<" + Environment.NewLine +
                "[<a>]" + Environment.NewLine +
                ">>" + Environment.NewLine;
            string result = group.Show();
            Assert.AreEqual(expected, result);
        }