Skip to content

Commit

Permalink
MCAssertStatementsPrettyPrinterTest cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SE-FDr committed Dec 5, 2024
1 parent 206e36e commit 71b4ce9
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@
import de.monticore.statements.testmcassertstatements._parser.TestMCAssertStatementsParser;
import de.se_rwth.commons.logging.Log;
import de.se_rwth.commons.logging.LogStub;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;
import java.util.Optional;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class MCAssertStatementsPrettyPrinterTest {

private TestMCAssertStatementsParser parser = new TestMCAssertStatementsParser();
private TestMCAssertStatementsParser parser;

@BeforeEach
public void init() {
Expand All @@ -29,18 +31,18 @@ public void init() {
@Test
public void testAssertStatement() throws IOException {
Optional<ASTAssertStatement> result = parser.parse_StringAssertStatement("assert a : b;");
Assertions.assertFalse(parser.hasErrors());
Assertions.assertTrue(result.isPresent());
assertFalse(parser.hasErrors());
assertTrue(result.isPresent());
ASTAssertStatement ast = result.get();

String output = TestMCAssertStatementsMill.prettyPrint(ast, true);

result = parser.parse_StringAssertStatement(output);
Assertions.assertFalse(parser.hasErrors());
Assertions.assertTrue(result.isPresent());
assertFalse(parser.hasErrors());
assertTrue(result.isPresent());

assertTrue(ast.deepEquals(result.get()));

Assertions.assertTrue(ast.deepEquals(result.get()));

Assertions.assertTrue(Log.getFindings().isEmpty());
assertTrue(Log.getFindings().isEmpty());
}
}

0 comments on commit 71b4ce9

Please sign in to comment.