package nl.utwente.viskell.ghcj;

import nl.utwente.viskell.haskell.env.Environment;
import nl.utwente.viskell.haskell.expr.Expression;
import nl.utwente.viskell.haskell.expr.Value;
import nl.utwente.viskell.haskell.type.Type;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class GhciSessionTest {
    /** Our session with Ghci. */
    private GhciSession ghci = null;
    private Environment env;

    private Expression pi;

    @Before
    public void setUp() throws HaskellException {
        this.env = new Environment();
        this.ghci = new GhciSession();

        this.env.addTestSignature("my_pi", "Float");
        this.pi = new Value(Type.con("Float"), "3.14");
    }

    @Test
    public void constFunPush() throws HaskellException {
        this.ghci.push("my_pi", this.pi);
        Assert.assertEquals("(3.14)", this.pi.toHaskell());
    }

    @Test
    public void constFunPushPull() throws HaskellException {
        this.ghci.push("my_pi", this.pi);
        Assert.assertEquals("3.14", this.ghci.pullRaw("my_pi"));
    }
}

@@ -220,16 +220,40 @@
 e.Type;%0A
+import org.junit.After;%0A
 import o
@@ -616,16 +616,82 @@
 ssion();
+%0A        this.ghci.startAsync();%0A        this.ghci.awaitRunning();
 %0A%0A      
@@ -792,32 +792,147 @@
 %223.14%22);%0A    %7D%0A%0A
+    @After%0A    public void tearDown() %7B%0A        this.ghci.stopAsync();%0A        this.ghci.awaitTerminated();%0A    %7D%0A%0A
     @Test%0A    pu
@@ -1135,39 +1135,32 @@
 shPull() throws 
-Haskell
 Exception %7B%0A    
@@ -1259,16 +1259,22 @@
 %22my_pi%22)
+.get()
 );%0A    %7D

Update GhciSessionTest