use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class PatternMatchTest method testMatch_1.
@Test
public void testMatch_1() throws Exception {
final OtpBindings r = OtpErlang.match("[W, V]", "[\"a\", {[1, 2]}]");
Assert.assertEquals(r.get("W"), new OtpErlangString("a"));
Assert.assertEquals(r.get("V"), OtpErlang.parse("{[1, 2]}"));
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class TermParserTest method string_2.
@Test
public void string_2() throws OtpParserException {
final OtpErlangString r = (OtpErlangString) termParser.parse("\"Hello world!\"");
Assert.assertEquals(r.stringValue(), "Hello world!");
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class UtilTest method testIoListToString_small.
@Test
public void testIoListToString_small() {
final OtpErlangObject input = OtpErlang.mkList(new OtpErlangString("hej"), new OtpErlangString("hoj"));
final String result = Util.ioListToString(input, 10);
final String expected = "hejhoj";
Assert.assertEquals(expected, result);
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class UtilTest method testIoListToString_large1.
@Test
public void testIoListToString_large1() {
final OtpErlangObject input = OtpErlang.mkList(new OtpErlangString("hej"), new OtpErlangString("hoj"));
final String result = Util.ioListToString(input, 4);
final String expected = "hejh... <truncated>";
Assert.assertEquals(expected, result);
}
use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.
the class CommandData method addUserInput.
// non-interactive
public void addUserInput(final List<String> input) {
final List<OtpErlangObject> argsTmp = new LinkedList<>();
final OtpErlangObject[] userInput = new OtpErlangObject[input.size()];
int i = 0;
for (final String text : input) {
userInput[i] = new OtpErlangString(text);
i++;
}
for (final OtpErlangObject arg : args) {
if (arg instanceof OtpErlangTuple && ((OtpErlangTuple) arg).elementAt(0).equals(new OtpErlangAtom("prompt"))) {
argsTmp.add(new OtpErlangList(userInput));
// TODO make it so that it adds input only once, check repeat
// interactive
} else {
argsTmp.add(arg);
}
}
args = argsTmp.toArray(new OtpErlangObject[0]);
}
Aggregations