Search in sources :

Example 6 with OtpBindings

use of org.erlide.util.erlang.OtpBindings in project erlide_eclipse by erlang.

the class PatternMatchTest method testMatch_sig_a.

@Test
public void testMatch_sig_a() throws Exception {
    final OtpBindings r = OtpErlang.match("W:a", "zzz");
    Assert.assertEquals(r.get("W"), new OtpErlangAtom("zzz"));
}
Also used : OtpBindings(org.erlide.util.erlang.OtpBindings) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) Test(org.junit.Test)

Example 7 with OtpBindings

use of org.erlide.util.erlang.OtpBindings in project erlide_eclipse by erlang.

the class PatternMatchTest method testMatch_any.

@Test
public void testMatch_any() throws Exception {
    final OtpBindings r = OtpErlang.match("[_, {_}]", "[a, {b}]");
    Assert.assertNotNull(r);
}
Also used : OtpBindings(org.erlide.util.erlang.OtpBindings) Test(org.junit.Test)

Example 8 with OtpBindings

use of org.erlide.util.erlang.OtpBindings in project erlide_eclipse by erlang.

the class PatternMatchTest method testMatch_same.

@Test
public void testMatch_same() throws Exception {
    final OtpBindings r = OtpErlang.match("[W, {V}]", "[a, {a}]");
    Assert.assertEquals(r.get("W"), new OtpErlangAtom("a"));
}
Also used : OtpBindings(org.erlide.util.erlang.OtpBindings) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) Test(org.junit.Test)

Example 9 with OtpBindings

use of org.erlide.util.erlang.OtpBindings in project erlide_eclipse by erlang.

the class PatternMatchTest method testMatch_ellipsis_2.

@Test
public void testMatch_ellipsis_2() throws Exception {
    final OtpBindings r = OtpErlang.match("[X | T]", "[x,y,z]");
    Assert.assertNotNull(r);
    Assert.assertEquals(new OtpErlangAtom("x"), r.get("X"));
    Assert.assertEquals(termParser.parse("[y,z]"), r.get("T"));
}
Also used : OtpBindings(org.erlide.util.erlang.OtpBindings) OtpErlangAtom(com.ericsson.otp.erlang.OtpErlangAtom) Test(org.junit.Test)

Example 10 with OtpBindings

use of org.erlide.util.erlang.OtpBindings in project erlide_eclipse by erlang.

the class PatternMatchTest method testMatch_sig_fail.

@Test
public void testMatch_sig_fail() throws Exception {
    final OtpBindings r = OtpErlang.match("W:i", "zzz");
    Assert.assertNull(r);
}
Also used : OtpBindings(org.erlide.util.erlang.OtpBindings) Test(org.junit.Test)

Aggregations

OtpBindings (org.erlide.util.erlang.OtpBindings)24 Test (org.junit.Test)13 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)9 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)9 OtpParserException (org.erlide.util.erlang.OtpParserException)7 OtpErlangException (com.ericsson.otp.erlang.OtpErlangException)6 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)3 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)2 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)2 Collection (java.util.Collection)2 RpcException (org.erlide.runtime.rpc.RpcException)2 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)1 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)1 Subscribe (com.google.common.eventbus.Subscribe)1 ArrayList (java.util.ArrayList)1 ErlangFunction (org.erlide.engine.model.erlang.ErlangFunction)1 FunctionRef (org.erlide.engine.model.erlang.FunctionRef)1