Search in sources :

Example 1 with NotOkToStar

use of ast.ErrorMessage.NotOkToStar in project L42 by ElvisResearchGroup.

the class TestLibrary method test.

@Test()
public void test() {
    Program p = TestProgram.p(sProg);
    ClassB cb1Pre = (ClassB) Desugar.of(Parser.parse(null, s1)).accept(new InjectionOnCore());
    cb1Pre = new programReduction.Norm().norm(p.evilPush(cb1Pre));
    TOut out;
    try {
        out = TypeSystem.instance().type(TIn.top(Phase.Coherent, p, cb1Pre));
    } catch (NotOkToStar coh) {
        assert s2 == ErrorKind.LibraryNotCoherent;
        return;
    }
    if (s2 instanceof ErrorKind) {
        assert !out.isOk();
        ErrorKind kind = out.toError().kind;
        assert kind == s2;
    } else {
        assert out.isOk() : "";
        ClassB cb1 = (ClassB) out.toOk().annotated;
        ClassB cbExpected = s2 == sameAsFormer ? cb1Pre : (ClassB) Desugar.of(Parser.parse(null, (String) s2)).accept(new InjectionOnCore());
        TestHelper.assertEqualExp(cb1, cbExpected);
    }
}
Also used : TestProgram(programReduction.TestProgram) Program(programReduction.Program) NotOkToStar(ast.ErrorMessage.NotOkToStar) ClassB(ast.ExpCore.ClassB) InjectionOnCore(sugarVisitors.InjectionOnCore) Test(org.junit.Test)

Aggregations

NotOkToStar (ast.ErrorMessage.NotOkToStar)1 ClassB (ast.ExpCore.ClassB)1 Test (org.junit.Test)1 Program (programReduction.Program)1 TestProgram (programReduction.TestProgram)1 InjectionOnCore (sugarVisitors.InjectionOnCore)1