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());
}
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()));
}
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());
}
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());
}
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());
}
Aggregations