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); }
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); }
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); }
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); }