You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you wish to include text immediately following a #else directive you will need to use curly brackets immediately surrounding the directive to differentiate it from the following text. (Any directive can be delimited by curly brackets, although this is most useful for #else).
But it doesn't work.
var context = new VelocityContext();
var engine = new VelocityEngine();
var sw = new StringWriter();
var template = "#if(1 == 1)it's true!#{else}it's not!#end";
engine.Init();
engine.Evaluate(context, sw, "", template);
var expected = "it's true!";
Assert.AreEqual(expected, sw.ToString()); // <-- fails, actual (wrong) result is "it's true!#{else}it's not!"
The text was updated successfully, but these errors were encountered:
According to http://velocity.apache.org/engine/devel/user-guide.html#if-elseif-else
But it doesn't work.
The text was updated successfully, but these errors were encountered: