Skip to content
Snippets Groups Projects
Commit cc78428d authored by dgelessus's avatar dgelessus
Browse files

Split the two variants of TestUtil.test

parent b6a9820e
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ package de.tlc4b.tlc.integration; ...@@ -3,6 +3,7 @@ package de.tlc4b.tlc.integration;
import static de.tlc4b.TLC4BOption.*; import static de.tlc4b.TLC4BOption.*;
import static de.tlc4b.tlc.TLCResults.TLCResult.*; import static de.tlc4b.tlc.TLCResults.TLCResult.*;
import static de.tlc4b.util.TestUtil.test; import static de.tlc4b.util.TestUtil.test;
import static de.tlc4b.util.TestUtil.testWithTrace;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import org.junit.Test; import org.junit.Test;
...@@ -65,7 +66,7 @@ public class SpecialTest { ...@@ -65,7 +66,7 @@ public class SpecialTest {
public void testCustomOutputDir() throws Exception { public void testCustomOutputDir() throws Exception {
Path specialDir = Paths.get("./src/test/resources/special/veryspecialoutput"); Path specialDir = Paths.get("./src/test/resources/special/veryspecialoutput");
String[] a = new String[] { "./src/test/resources/errors/InvariantError.mch", OUTPUT.cliArg(), specialDir.toString()}; String[] a = new String[] { "./src/test/resources/errors/InvariantError.mch", OUTPUT.cliArg(), specialDir.toString()};
assertEquals(InvariantViolation, test(a, true)); assertEquals(InvariantViolation, testWithTrace(a));
assertTrue(Files.deleteIfExists(specialDir.resolve("InvariantError.tla"))); assertTrue(Files.deleteIfExists(specialDir.resolve("InvariantError.tla")));
assertTrue(Files.deleteIfExists(specialDir.resolve("InvariantError.cfg"))); assertTrue(Files.deleteIfExists(specialDir.resolve("InvariantError.cfg")));
...@@ -81,7 +82,7 @@ public class SpecialTest { ...@@ -81,7 +82,7 @@ public class SpecialTest {
logFile.toFile().delete(); logFile.toFile().delete();
String[] a = new String[] { machineFile.toString(), LOG.cliArg(), logFile.toString(), COVERAGE.cliArg()}; String[] a = new String[] { machineFile.toString(), LOG.cliArg(), logFile.toString(), COVERAGE.cliArg()};
assertEquals(InvariantViolation, test(a, true)); assertEquals(InvariantViolation, testWithTrace(a));
List<String> lines = Files.readAllLines(logFile); List<String> lines = Files.readAllLines(logFile);
assertEquals(lines.size(), 12); assertEquals(lines.size(), 12);
......
...@@ -178,19 +178,15 @@ public class TestUtil { ...@@ -178,19 +178,15 @@ public class TestUtil {
} }
public static TLCResult test(String[] args) throws IOException { public static TLCResult test(String[] args) throws IOException {
return test(args, false); String[] newArgs = Arrays.copyOf(args, args.length + 1);
newArgs[args.length] = NOTRACE.cliArg();
String runnerClassName = TLC4BTester.class.getCanonicalName();
return runTLC(runnerClassName, newArgs);
} }
public static TLCResult test(String[] args, boolean createTrace) throws IOException { public static TLCResult testWithTrace(String[] args) throws IOException {
String runnerClassName = TLC4BTester.class.getCanonicalName(); String runnerClassName = TLC4BTester.class.getCanonicalName();
String[] newArgs; return runTLC(runnerClassName, args);
if (createTrace) {
newArgs = args;
} else {
newArgs = Arrays.copyOf(args, args.length + 1);
newArgs[args.length] = NOTRACE.cliArg();
}
return runTLC(runnerClassName, newArgs);
} }
private static TLCResult runTLC(String runnerClassName, String[] args) throws IOException { private static TLCResult runTLC(String runnerClassName, String[] args) throws IOException {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment