diff graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java @ 21469:286aef83a9a7

Replacing PrintStream with PrintWriter in the simple language
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Fri, 22 May 2015 18:12:01 +0200
parents 73b1844b5b14
children
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java	Fri May 22 13:41:10 2015 +0200
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/instrument/SLInstrumentTestRunner.java	Fri May 22 18:12:01 2015 +0200
@@ -202,7 +202,7 @@
         notifier.fireTestStarted(testCase.name);
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        PrintStream printer = new PrintStream(out);
+        PrintWriter printer = new PrintWriter(out);
         final ASTProber prober = new SLStandardASTProber();
         Probe.registerASTProber(prober);
         try {
@@ -226,6 +226,7 @@
                 notifier.fireTestFailure(new Failure(testCase.name, new UnsupportedOperationException("No instrumentation found.")));
             }
 
+            printer.flush();
             String actualOutput = new String(out.toByteArray());
             Assert.assertEquals(testCase.expectedOutput, actualOutput);
         } catch (Throwable ex) {
@@ -270,15 +271,15 @@
 
     /**
      * This sample listener provides prints the value of an assignment (after the assignment is
-     * complete) to the {@link PrintStream} specified in the constructor. This listener can only be
+     * complete) to the {@link PrintWriter} specified in the constructor. This listener can only be
      * attached at {@link SLWriteLocalVariableNode}, but provides no guards to protect it from being
      * attached elsewhere.
      */
     public final class SLPrintAssigmentValueListener extends DefaultSimpleInstrumentListener {
 
-        private PrintStream output;
+        private PrintWriter output;
 
-        public SLPrintAssigmentValueListener(PrintStream output) {
+        public SLPrintAssigmentValueListener(PrintWriter output) {
             this.output = output;
         }