I've been trying over and over to get the right results with this version, but to no avail.<br><br>I dumped everything and just created a clean project with the test in it...<br><br>I ran the same test and it always is false... $Today.Year$ is evaluating to "8434."<br>
<br>For fun, I went back and tried the same test in versions 3.0 and 3.1b1 and it succeeds as expected.<br>
<br>I feel like it is a reflection error, but I am unable to track it down... Is the source code available?<br><br>Thanks,<br><br clear="all">Dustin Lambert<br><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>
From: <b class="gmail_sendername">Sam Harwell</b> <span dir="ltr"><<a href="mailto:sharwell@pixelminegames.com" target="_blank">sharwell@pixelminegames.com</a>></span><br>
Date: Tue, Aug 4, 2009 at 3:07 PM<br>Subject: RE: [stringtemplate-interest] Current C# Dev Version<br>To: "Dustin A. Lambert" <<a href="mailto:dustin@biztechetc.com" target="_blank">dustin@biztechetc.com</a>><br>
Cc: <a href="mailto:stringtemplate-interest@antlr.org" target="_blank">stringtemplate-interest@antlr.org</a><br>
<br><br>
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Hi Dustin,</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">I added a unit test to the StringTemplate test suite and it
passes without any changes:</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 8pt; font-family: Consolas;">[<span style="color: rgb(43, 145, 175);">TestMethod</span>]</span></p>
<p><span style="font-size: 8pt; font-family: Consolas; color: blue;">public</span><span style="font-size: 8pt; font-family: Consolas;"> <span style="color: blue;">void</span>
TestDateTimeFormatting()</span></p>
<p><span style="font-size: 8pt; font-family: Consolas;">{</span></p>
<p><span style="font-size: 8pt; font-family: Consolas;"> <span style="color: rgb(43, 145, 175);">StringTemplate</span> e =
<span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">StringTemplate</span>(</span></p><div>
<p><span style="font-size: 8pt; font-family: Consolas;"> <span style="color: rgb(163, 21, 21);">"<p>&copy;
2008- $Today.Year$ . All rights reserved.</p>"</span></span></p>
</div><p><span style="font-size: 8pt; font-family: Consolas;"> );</span></p>
<p><span style="font-size: 8pt; font-family: Consolas;"> e = e.GetInstanceOf();</span></p>
<p><span style="font-size: 8pt; font-family: Consolas;"> e.SetAttribute(<span style="color: rgb(163, 21, 21);">"Today"</span>,
<span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">DateTime</span>(2009,
8, 4));</span></p>
<p><span style="font-size: 8pt; font-family: Consolas;"> <span style="color: blue;">string</span> expecting = <span style="color: rgb(163, 21, 21);">"<p>&copy; 2008- 2009 . All rights
reserved.</p>"</span>;</span></p>
<p><span style="font-size: 8pt; font-family: Consolas;"> <span style="color: rgb(43, 145, 175);">Assert</span>.AreEqual(expecting,
e.ToString());</span></p>
<p><span style="font-size: 8pt; font-family: Consolas;">}</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Sam</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> Dustin A. Lambert
[mailto:<a href="mailto:dustin@biztechetc.com" target="_blank">dustin@biztechetc.com</a>] <br>
<b>Sent:</b> Tuesday, August 04, 2009 1:37 PM<br>
<b>To:</b> Sam Harwell<br>
<b>Cc:</b> <a href="mailto:stringtemplate-interest@antlr.org" target="_blank">stringtemplate-interest@antlr.org</a><br>
<b>Subject:</b> Re: [stringtemplate-interest] Current C# Dev Version</span></p>
</div><div><div></div><div>
<p> </p>
<p style="margin-bottom: 12pt;">I'm using 3.2... from file:
StringTemplate-3.2-2009-06-28.7z<br>
<br>
When I look at the version on Antlr3.StringTemplate, it states "3.1.3.6002"<br>
<br>
I've removed and re-added several times... I get the same result.<br>
<br>
<br>
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...<br>
<br clear="all">
Dustin Lambert<br>
<br>
<br>
</p>
<div>
<p>On Tue, Aug 4, 2009 at 2:22 PM, Sam Harwell <<a href="mailto:sharwell@pixelminegames.com" target="_blank">sharwell@pixelminegames.com</a>>
wrote:</p>
<div>
<div>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">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).” :)</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Sam</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-style: solid none none; border-color: -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> <a href="mailto:stringtemplate-interest-bounces@antlr.org" target="_blank">stringtemplate-interest-bounces@antlr.org</a> [mailto:<a href="mailto:stringtemplate-interest-bounces@antlr.org" target="_blank">stringtemplate-interest-bounces@antlr.org</a>]
<b>On Behalf Of </b>Dustin A. Lambert<br>
<b>Sent:</b> Tuesday, August 04, 2009 6:19 AM<br>
<b>To:</b> <a href="mailto:stringtemplate-interest@antlr.org" target="_blank">stringtemplate-interest@antlr.org</a><br>
<b>Subject:</b> [stringtemplate-interest] Current C# Dev Version</span></p>
</div>
<div>
<div>
<p> </p>
<p style="margin-bottom: 12pt;">Greetings,<br>
<br>
I've been testing the latest C# beta and discovered a problem...<br>
<br>
If I set a template parameter to an object of System.DateTime like so:<br>
var master = Global.Templates.GetInstanceOf("master");<br>
master.SetAttribute("Today", System.DateTime.Now);<br>
<br>
And then in the template do something like this:<br>
<p>&copy; 2008- $Today.Year$ . All rights reserved.</p><br>
<br>
$Today.Year$ comes out as a weird number... i.e. "© 2008- 10540 "<br>
<br>
I checked for custom renderers and did not find any..<br>
?master.GetAttributeRenderer(typeof(DateTime))<br>
null<br>
<br>
?master.GetAttributeRenderer(typeof(int))<br>
null<br>
<br>
Any suggestions?<br>
<br>
Thanks!<br>
<br clear="all">
Dustin Lambert</p>
</div>
</div>
</div>
</div>
</div>
<p> </p>
</div></div></div>
</div>
</div><br>