]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/TestCommandSession.java
Merged changes from feature/scl to master.
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / TestCommandSession.java
diff --git a/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/TestCommandSession.java b/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/TestCommandSession.java
deleted file mode 100644 (file)
index a93f706..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.simantics.scl.compiler.tests;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.simantics.scl.compiler.commands.CommandSession;
-import org.simantics.scl.compiler.module.repository.ModuleRepository;
-import org.simantics.scl.compiler.source.repository.CompositeModuleSourceRepository;
-import org.simantics.scl.compiler.source.repository.SourceRepositories;
-import org.simantics.scl.runtime.reporting.AbstractSCLReportingHandler;
-import org.simantics.scl.runtime.reporting.SCLReportingHandler;
-
-public class TestCommandSession {
-
-    ModuleRepository moduleRepository;
-
-    @Before
-    public void initialize() throws Exception {
-        moduleRepository = new ModuleRepository(
-                new CompositeModuleSourceRepository(
-                        SourceRepositories.BUILTIN_SOURCE_REPOSITORY,
-                        SourceRepositories.PRELUDE_SOURCE_REPOSITORY
-                        ));
-    }
-    
-    private static class SCLErrorMessageException extends RuntimeException {
-        private static final long serialVersionUID = 418954639267697065L;
-        public SCLErrorMessageException(String message) {
-            super(message);
-        }
-    }
-    
-    private static final SCLReportingHandler TEST_HANDLER = new AbstractSCLReportingHandler() {
-        @Override
-        public void print(String text) {
-            System.out.println(text);
-        }
-        
-        public void printError(String error) {
-            System.err.println(error);
-            throw new SCLErrorMessageException(error);
-        }
-    };
-
-    @Test
-    public void testCommandSession() {
-        CommandSession session = new CommandSession(moduleRepository, TEST_HANDLER);
-        
-        session.execute("a = 1");
-        session.execute("b = 2");
-        session.execute("a + b");
-        
-        session.execute("x = 1\ny = 2");
-        session.execute("x + y");
-    }
-    
-    @Test
-    public void testCommandSession2() {
-        CommandSession session = new CommandSession(moduleRepository, TEST_HANDLER);
-        
-        session.execute("f name coords = print \"\\(name :: String) \\(coords :: (Double, Double))\"");
-        session.execute("g name (x,y) = f name (x,y)");
-    }
-    
-    @Test
-    public void testTyping1() {
-        CommandSession session = new CommandSession(moduleRepository, TEST_HANDLER);
-        
-        session.execute("apply f = f ()");
-        session.execute("printHello () = print \"Hello\"");
-        session.execute("apply printHello");
-    }
-    
-    @Test
-    public void testTyping2() {
-        CommandSession session = new CommandSession(moduleRepository, TEST_HANDLER);
-        
-        session.execute("iter f (list :: [a]) = loop 0 where { len = length list ; loop i | i == len = 0 | otherwise = do f (list!i) ; loop (i+1) }");
-        session.execute("iter (\\i -> print i) [1,2,3]");
-        session.execute("iter (\\i -> print i) [(),(),()]");
-    }
-
-}