Search in sources :

Example 66 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class ParFnAppTest method tooFewArgsForFuncParam.

@Test
public void tooFewArgsForFuncParam() {
    Model m = parse("apply(tooMany)(0);", applyFunction(), "def Int tooMany(Int i, Int j) = 0;");
    m.expandPartialFunctions();
    SemanticConditionList conditions = m.typeCheck();
    assertTrue(conditions.containsErrors());
}
Also used : SemanticConditionList(org.abs_models.frontend.analyser.SemanticConditionList) Model(org.abs_models.frontend.ast.Model) Test(org.junit.Test)

Example 67 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class BackPositionTest method assertNodeAtPos.

private void assertNodeAtPos(String absCode, int line, int col, Class<?> clazz) {
    Model m = assertParse(absCode, WITHOUT_MODULE_NAME);
    SourcePosition pos = SourcePosition.findPosition(m.getCompilationUnit(1), line, col);
    assertNotNull("Expected to find " + clazz + " at " + line + ":" + col + " but found nothing", pos);
    assertTrue("Expected " + clazz + " but found " + pos.getContextNode().getClass(), clazz.isInstance(pos.getContextNode()));
}
Also used : Model(org.abs_models.frontend.ast.Model)

Example 68 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class DeltaSamplesTest method test_ticket332_check.

@Test
public void test_ticket332_check() throws Exception {
    Model m = assertTypeCheckFileOk("abssamples/deltas/ticket332.abs");
    m.flushCache();
    m.flattenForProduct("C");
    m.flushCache();
    assertTrue(!m.typeCheck().containsErrors());
}
Also used : Model(org.abs_models.frontend.ast.Model) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 69 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class DeltaSamplesTest method test_P2P_P1.

@Test
public void test_P2P_P1() throws Exception {
    Model m = assertParseFileOk("abssamples/deltas/PeerToPeer.abs");
    m.setNullPrintStream();
    m.flattenForProduct("P1");
    m.flushCache();
    assertTrue(!m.typeCheck().containsErrors());
}
Also used : Model(org.abs_models.frontend.ast.Model) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Example 70 with Model

use of org.abs_models.frontend.ast.Model in project abstools by abstools.

the class DeltaSamplesTest method test_ticket329_missingLineNo.

@Test
public void test_ticket329_missingLineNo() throws Exception {
    Model m = assertParseFileOk("abssamples/deltas/bug329.abs");
    SemanticConditionList errs = m.typeCheck();
    /* We are expecting a missing delta in product M.PL: */
    assertThat(errs.getFirstError(), instanceOf(TypeError.class));
    TypeError te = (TypeError) errs.getFirstError();
    Assert.assertEquals(ErrorMessage.NAME_NOT_RESOLVABLE, te.msg);
    Assert.assertEquals(10, te.getLine());
}
Also used : SemanticConditionList(org.abs_models.frontend.analyser.SemanticConditionList) Model(org.abs_models.frontend.ast.Model) TypeError(org.abs_models.frontend.analyser.TypeError) FrontendTest(org.abs_models.frontend.FrontendTest) Test(org.junit.Test)

Aggregations

Model (org.abs_models.frontend.ast.Model)268 Test (org.junit.Test)227 FrontendTest (org.abs_models.frontend.FrontendTest)101 ClassDecl (org.abs_models.frontend.ast.ClassDecl)72 DeltaDecl (org.abs_models.frontend.ast.DeltaDecl)34 SemanticConditionList (org.abs_models.frontend.analyser.SemanticConditionList)29 ABSTest (org.abs_models.ABSTest)22 ProductDecl (org.abs_models.frontend.ast.ProductDecl)17 FunctionDecl (org.abs_models.frontend.ast.FunctionDecl)15 HashSet (java.util.HashSet)13 ModifyClassModifier (org.abs_models.frontend.ast.ModifyClassModifier)13 PrintStream (java.io.PrintStream)12 Product (org.abs_models.frontend.ast.Product)11 SkipStmt (org.abs_models.frontend.ast.SkipStmt)11 VarUse (org.abs_models.frontend.ast.VarUse)11 Feature (org.abs_models.frontend.ast.Feature)10 File (java.io.File)9 ExpFunctionDef (org.abs_models.frontend.ast.ExpFunctionDef)9 ReturnStmt (org.abs_models.frontend.ast.ReturnStmt)9 KindedName (org.abs_models.frontend.typechecker.KindedName)9