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

Make TestUtil not unwrap BCompoundExceptions

parent 30cb6226
No related branches found
No related tags found
Loading
...@@ -12,7 +12,6 @@ import java.util.Arrays; ...@@ -12,7 +12,6 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.be4.classicalb.core.parser.exceptions.BCompoundException;
import de.be4.classicalb.core.parser.exceptions.BException;
import de.tla2b.exceptions.TLA2BException; import de.tla2b.exceptions.TLA2BException;
import de.tlc4b.TLC4BGlobals; import de.tlc4b.TLC4BGlobals;
import de.tlc4b.Translator; import de.tlc4b.Translator;
...@@ -80,17 +79,11 @@ public class TestUtil { ...@@ -80,17 +79,11 @@ public class TestUtil {
assertEquals(expectedB, actualB); assertEquals(expectedB, actualB);
} }
public static void tryTranslating(final String machineString) throws BException { public static void tryTranslating(final String machineString) throws BCompoundException {
TLC4BGlobals.setForceTLCToEvalConstants(false); TLC4BGlobals.setForceTLCToEvalConstants(false);
ToolIO.setMode(ToolIO.TOOL); ToolIO.setMode(ToolIO.TOOL);
Translator b2tlaTranslator; Translator b2tlaTranslator = new Translator(machineString);
try {
b2tlaTranslator = new Translator(machineString);
b2tlaTranslator.translate(); b2tlaTranslator.translate();
} catch (BCompoundException e) {
throw e.getFirstException();
}
} }
public static String translateTLA2B(String moduleName, String tlaString, String configString) public static String translateTLA2B(String moduleName, String tlaString, String configString)
...@@ -131,25 +124,16 @@ public class TestUtil { ...@@ -131,25 +124,16 @@ public class TestUtil {
assertEquals(expectedConfig, b2tlaTranslator.getConfigString()); assertEquals(expectedConfig, b2tlaTranslator.getConfigString());
} }
public static void compareEquals(String expected, String machine) throws BException { public static void compareEquals(String expected, String machine) throws BCompoundException {
try {
Translator b2tlaTranslator = new Translator(machine); Translator b2tlaTranslator = new Translator(machine);
b2tlaTranslator.translate(); b2tlaTranslator.translate();
assertEquals(expected, b2tlaTranslator.getModuleString()); assertEquals(expected, b2tlaTranslator.getModuleString());
} catch (BCompoundException e) {
throw e.getFirstException();
} }
} public static String translate(String machine) throws BCompoundException {
public static String translate(String machine) throws BException {
try {
Translator translator = new Translator(machine); Translator translator = new Translator(machine);
translator.translate(); translator.translate();
return translator.getModuleString(); return translator.getModuleString();
} catch (BCompoundException e) {
throw e.getFirstException();
}
} }
public static TLCResult testString(String machineString) throws IOException { public static TLCResult testString(String machineString) throws IOException {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment