[stringtemplate-interest] Current C# Dev Version

Sam Harwell sharwell at pixelminegames.com
Tue Aug 4 12:07:07 PDT 2009


Hi Dustin,

 

I added a unit test to the StringTemplate test suite and it passes
without any changes:

 

[TestMethod]

public void TestDateTimeFormatting()

{

    StringTemplate e = new StringTemplate(

            "<p>&copy; 2008- $Today.Year$ . All rights reserved.</p>"

        );

    e = e.GetInstanceOf();

    e.SetAttribute("Today", new DateTime(2009, 8, 4));

    string expecting = "<p>&copy; 2008- 2009 . All rights
reserved.</p>";

    Assert.AreEqual(expecting, e.ToString());

}

 

Sam

 

 

From: Dustin A. Lambert [mailto:dustin at biztechetc.com] 
Sent: Tuesday, August 04, 2009 1:37 PM
To: Sam Harwell
Cc: stringtemplate-interest at antlr.org
Subject: Re: [stringtemplate-interest] Current C# Dev Version

 

I'm using 3.2... from file: StringTemplate-3.2-2009-06-28.7z

When I look at the version on Antlr3.StringTemplate, it states
"3.1.3.6002"

I've removed and re-added several times... I get the same result.


I setup a renderer for integers and ST is passing through the weird
numbers, so I suppose that it is a problem with reading off the int from
DateTime...

Dustin Lambert




On Tue, Aug 4, 2009 at 2:22 PM, Sam Harwell
<sharwell at pixelminegames.com> wrote:

When you say you were testing the latest beta, were you talking about
mine (3.2) or the one previously (before last weekend) posted as the
"latest beta (3.1)." :)

 

Sam

 

From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Dustin
A. Lambert
Sent: Tuesday, August 04, 2009 6:19 AM
To: stringtemplate-interest at antlr.org
Subject: [stringtemplate-interest] Current C# Dev Version

 

Greetings,

I've been testing the latest C# beta and discovered a problem...

If I set a template parameter to an object of System.DateTime like so:
var master = Global.Templates.GetInstanceOf("master");
master.SetAttribute("Today", System.DateTime.Now);

And then in the template do something like this:
<p>&copy; 2008- $Today.Year$ . All rights reserved.</p>

$Today.Year$ comes out as a weird number... i.e. "(c) 2008- 10540 "

I checked for custom renderers and did not find any..
?master.GetAttributeRenderer(typeof(DateTime))
null

?master.GetAttributeRenderer(typeof(int))
null

Any suggestions?

Thanks!

Dustin Lambert

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20090804/28167a8a/attachment.html 


More information about the stringtemplate-interest mailing list