1 package org.simantics.scl.compiler.tests;
3 import java.io.StringReader;
4 import java.io.StringWriter;
6 import org.junit.Assert;
8 import org.simantics.scl.compiler.commands.CommandSessionWithModules;
9 import org.simantics.scl.osgi.SCLOsgi;
11 public class TestCommandSessionWithModules {
13 public void testCommandSessionWithModules() {
14 CommandSessionWithModules session = new CommandSessionWithModules(SCLOsgi.MODULE_REPOSITORY);
15 session.putModule("My/Test/Module", "someValue = 13");
18 StringWriter writer = new StringWriter();
19 session.runCommands(new StringReader("import \"My/Test/Module\"\nsomeValue"), writer);
20 Assert.assertEquals("13\n", writer.toString());
23 session.putModule("My/Test/Module", "someValue = 14");
26 StringWriter writer = new StringWriter();
27 session.runCommands(new StringReader("someValue\nsomeValue+1"), writer);
28 Assert.assertEquals("14\n15\n", writer.toString());