Commit 5d0806ea authored by 0xJMR's avatar 0xJMR
Browse files

First shot at fixing tests for Linux.

parent a9120085
Pipeline #69015 failed with stages
in 1 minute and 5 seconds
......@@ -4,6 +4,7 @@ import de.monticore.lang.math._ast.ASTMathCompilationUnit;
import de.monticore.lang.math._parser.MathParser;
import de.se_rwth.commons.logging.Log;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.BeforeClass;
import org.junit.Test;
......@@ -15,7 +16,7 @@ import java.util.Optional;
import static org.junit.Assert.assertEquals;
public class TeXHTMLMathPrettyPrinterTest {
public class HTMLMathPrettyPrinterTest {
protected static File[] sourceModels;
protected static File[] targetModels;
......@@ -44,10 +45,12 @@ public class TeXHTMLMathPrettyPrinterTest {
Log.info(message, "HTMLMathPrettyPrinterTest");
Optional<ASTMathCompilationUnit> astOptional = parser.parse(sourceModel.toString());
String input = FileUtils.readFileToString(targetModel, "UTF-8").replaceAll("\\r\\n?", "\n");
String output = printer.prettyPrint(astOptional.get()).replaceAll("\\r\\n?", "\n");
String input = FileUtils.readFileToString(targetModel, "UTF-8");
String output = printer.prettyPrint(astOptional.get());
String separator = System.lineSeparator();
assertEquals(input, output);
assertEquals(StringUtils.countMatches(input, separator), StringUtils.countMatches(output, separator));
assertEquals(input.replaceAll("\\R", ""), output.replaceAll("\\R", ""));
}
}
}
......@@ -4,6 +4,7 @@ import de.monticore.lang.math._ast.ASTMathCompilationUnit;
import de.monticore.lang.math._parser.MathParser;
import de.se_rwth.commons.logging.Log;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.BeforeClass;
import org.junit.Test;
......@@ -45,10 +46,12 @@ public class MathPrettyPrinterTest {
Log.info(message, "MathPrettyPrinterTest");
Optional<ASTMathCompilationUnit> astOptional = parser.parse(sourceModel.toString());
String input = FileUtils.readFileToString(targetModel, "UTF-8").replaceAll("\\r\\n?", "\n");
String output = printer.prettyPrint(astOptional.get()).replaceAll("\\r\\n?", "\n");
String input = FileUtils.readFileToString(targetModel, "UTF-8");
String output = printer.prettyPrint(astOptional.get());
String separator = System.lineSeparator();
assertEquals(input, output);
assertEquals(StringUtils.countMatches(input, separator), StringUtils.countMatches(output, separator));
assertEquals(input.replaceAll("\\R", ""), output.replaceAll("\\R", ""));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment