package groovy.io;

import groovy.text.SimpleTemplateEngine;
import groovy.text.Template;
import junit.framework.TestCase;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

public class PlatformLineWriterTest extends TestCase {

    public void testPlatformLineWriter() throws IOException, ClassNotFoundException {
        String LS = System.getProperty("line.separator");
        Map binding = new HashMap();
        binding.put("first", "Tom");
        binding.put("last", "Adams");
        Template template = new SimpleTemplateEngine().createTemplate("<%= first %>\n<% println last %>");
        StringWriter stringWriter = new StringWriter();
        Writer platformWriter = new PlatformLineWriter(stringWriter);
        template.make(binding).writeTo(platformWriter);
        assertEquals("Tom" + LS + "Adams" + LS, stringWriter.toString());
    }
}

@@ -31,62 +31,52 @@
 ovy.
-text.SimpleTemplateEngine;%0Aimport groovy.text.Template
+lang.Binding;%0Aimport groovy.lang.GroovyShell
 ;%0Aim
@@ -190,56 +190,8 @@
 ter;
-%0Aimport java.util.HashMap;%0Aimport java.util.Map;
 %0A%0Apu
@@ -396,19 +396,23 @@
         
-Map
+Binding
  binding
@@ -422,15 +422,15 @@
 new 
-HashMap
+Binding
 ();%0A
@@ -445,19 +445,27 @@
 binding.
-put
+setVariable
 (%22first%22
@@ -494,11 +494,19 @@
 ing.
-put
+setVariable
 (%22la
@@ -532,33 +532,41 @@
     
-Template templa
+StringWriter stringWri
 te
+r
  = new S
 impl
@@ -565,102 +565,310 @@
 ew S
-impleTemplateEngine().createTempl
+tringWriter();%0A        Writer platformWriter = new PlatformLineWriter(stringWriter);%0A        GroovyShell shell = new GroovyShell(binding);%0A        platformWriter.write(shell.evalu
 ate(%22
-%3C%25= 
+%5C%22$
 first
- %25%3E%5Cn%3C%25 println last %25%3E%22);%0A        StringWriter
+%5C%5Cn$last%5C%5Cn%5C%22%22).toString());%0A        assertEquals(%22Tom%22 + LS + %22Adams%22 + LS, stringWriter.toString());%0A       
  str
@@ -899,39 +899,32 @@
 iter();%0A        
-Writer 
 platformWriter =
@@ -974,53 +974,85 @@
     
-tem
 plat
-e.make(binding).writeTo(platformWriter
+formWriter.write(shell.evaluate(%22%5C%22$first%5C%5Cr%5C%5Cn$last%5C%5Cr%5C%5Cn%5C%22%22).toString()
 );%0A 

Remove dependency on templating module