Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
None
-
None
-
None
Description
The following test case fails, because GStringTemplateEngine doesn't handle the binding correctly. It is shared among calls:
void testShouldNotShareBinding() { String text = "<% println delegate.books; books = books.split(\",\"); out << books %>"; StringWriter sw = new StringWriter(); GStringTemplateEngine engine = new GStringTemplateEngine(); Template template = engine.createTemplate(text); Map data = [books: 'a,b,c,d'] // round one sucess template.make(data).writeTo(sw); assert sw.toString() == '[a, b, c, d]' sw = new StringWriter(); // round two fails data = [books: 'e,f,g,h'] template.make(data).writeTo(sw); assert sw.toString() == '[e, f, g, h]' }