use of abs.frontend.ast.PartialFunctionDecl in project abstools by abstools.
the class PartialFunctionTest method prettyPrintImplemented.
@Test
public void prettyPrintImplemented() throws NotImplementedYetException, IOException {
Model model = expand(parse("apply(inc)(0);", applyFunction(), incFunction()));
PartialFunctionDecl func = getPartialFunction(model, "apply");
assertNotNull(func);
try (StringWriter writer = new StringWriter();
PrintWriter pw = new PrintWriter(writer)) {
func.prettyPrint(pw, new DefaultABSFormatter(pw));
assertFalse(writer.toString().isEmpty());
}
}
use of abs.frontend.ast.PartialFunctionDecl in project abstools by abstools.
the class PartialFunctionTest method noErlangCodeGenerated.
@Test
public void noErlangCodeGenerated() throws IOException, NotImplementedYetException {
Model model = expand(parse("apply(inc)(0);", applyFunction(), incFunction()));
PartialFunctionDecl func = getPartialFunction(model, "apply");
assertNotNull(func);
func.generateErlangCode(null);
}
use of abs.frontend.ast.PartialFunctionDecl in project abstools by abstools.
the class PartialFunctionTest method unusedFunctionNotRemoved.
@Test
public void unusedFunctionNotRemoved() {
Model model = expand(parse("", "def Int f()() = 0;"));
PartialFunctionDecl decl = getPartialFunction(model, "f");
assertNotNull("Unused pardef 'f' has been removed!", decl);
}
use of abs.frontend.ast.PartialFunctionDecl in project abstools by abstools.
the class PartialFunctionTest method noDynamicJavaCodeGenerated.
@Test
public void noDynamicJavaCodeGenerated() throws NotImplementedYetException, UnsupportedEncodingException {
Model model = expand(parse("apply(inc)(0);", applyFunction(), incFunction()));
PartialFunctionDecl func = getPartialFunction(model, "apply");
assertNotNull(func);
ByteArrayOutputStream os = new ByteArrayOutputStream();
func.generateJavaDynamic(new PrintStream(os));
assertEquals("", os.toString("utf-8"));
}
use of abs.frontend.ast.PartialFunctionDecl in project abstools by abstools.
the class PartialFunctionTest method noMaudeCodeGenerated.
@Test
public void noMaudeCodeGenerated() throws NotImplementedYetException, UnsupportedEncodingException {
Model model = testExpand(parse("apply(inc)(0);", applyFunction(), incFunction()), "Apply_%s_inc");
PartialFunctionDecl func = getPartialFunction(model, "apply");
assertNotNull(func);
ByteArrayOutputStream os = new ByteArrayOutputStream();
func.generateMaude(new PrintStream(os));
assertEquals("", os.toString("utf-8"));
}
Aggregations