Package gw.util
Class GosuTestUtil
- java.lang.Object
-
- gw.util.GosuTestUtil
-
public class GosuTestUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description GosuTestUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertCausesPRE(String script, ResourceKey... keys)static voidassertHasErrors(IGosuClass gsClass, ResourceKey... expected)static voidassertHasErrors(String strClass, ResourceKey... expected)static voidassertOneError(IGosuClass gsClass, ResourceKey errorKey)static voidassertOneError(String strClass, ResourceKey errorKey)static voidassertOneWarning(IGosuClass gsClass, ResourceKey warningKey)static voidassertOneWarning(String strClass, ResourceKey warningKey)static IExpressioncompileExpression(String script)static IExpressioncompileExpression(String script, boolean bThrowOnWarning)static IExpressioncompileExpression(String script, ISymbolTable table)static IExpressioncompileExpression(String script, ISymbolTable table, boolean bThrowOnWarning)static IExpressioncompileExpression(String script, String varName, IType varType)static IExpressioncompileExpression(String script, String varName, IType varType, String varName2, IType varType2)static IProgramcompileProgram(String script, ISymbolTable table)static Objecteval(String script)static Objecteval(String script, String name1, Object val1)static ObjectevalGosu(String script)Evaluates the given Gosu.static ObjectevalGosu(String script, ISymbolTable table)static ObjectevalGosu(String script, Object[] args)Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.static ObjectevalGosu(String script, String name1, Object val1)Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.static ObjectevalGosu(String script, String name1, Object val1, String name2, Object val2)Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.static ObjectevalGosu(String script, String name1, Object val1, String name2, Object val2, String name3, Object val3)Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.static ObjectevalGosu(String script, String name1, Object val1, String name2, Object val2, String name3, Object val3, String name4, Object val4)Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.static ObjectevalGosu(String script, String name1, Object val1, String name2, Object val2, String name3, Object val3, String name4, Object val4, String name5, Object val5)Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.static ParseResultsExceptiongetParseResultsException(String script)Gets the parse results exception caused by the given program.
-
-
-
Method Detail
-
evalGosu
public static Object evalGosu(String script) throws ParseResultsException
Evaluates the given Gosu.- Parameters:
script- - Must be non-null- Throws:
ParseResultsException
-
evalGosu
public static Object evalGosu(String script, String name1, Object val1) throws ParseResultsException
Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.- Parameters:
val1- - Must be non-null- Throws:
ParseResultsException
-
evalGosu
public static Object evalGosu(String script, String name1, Object val1, String name2, Object val2) throws ParseResultsException
Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.- Parameters:
val1- cannot be null.val2- cannot be null.- Throws:
ParseResultsException
-
evalGosu
public static Object evalGosu(String script, String name1, Object val1, String name2, Object val2, String name3, Object val3) throws ParseResultsException
Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.- Parameters:
val1- cannot be null.val2- cannot be null.val3- cannot be null.- Throws:
ParseResultsException
-
evalGosu
public static Object evalGosu(String script, String name1, Object val1, String name2, Object val2, String name3, Object val3, String name4, Object val4) throws ParseResultsException
Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.- Parameters:
val1- cannot be null.val2- cannot be null.val3- cannot be null.val4- cannot be null.- Throws:
ParseResultsException
-
evalGosu
public static Object evalGosu(String script, String name1, Object val1, String name2, Object val2, String name3, Object val3, String name4, Object val4, String name5, Object val5) throws ParseResultsException
Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.- Parameters:
val1- cannot be null.val2- cannot be null.val3- cannot be null.val4- cannot be null.val5- cannot be null.- Throws:
ParseResultsException
-
evalGosu
public static Object evalGosu(String script, Object[] args) throws ParseResultsException
Evaluates the given Gosu, with variables of the given names that will be the dynamic (runtime) type of the values passed in.- Parameters:
args- must be an array of alternating non-null name/value pairs- Throws:
ParseResultsException
-
evalGosu
public static Object evalGosu(String script, ISymbolTable table) throws ParseResultsException
- Throws:
ParseResultsException
-
compileExpression
public static IExpression compileExpression(String script) throws ParseResultsException
- Throws:
ParseResultsException
-
compileExpression
public static IExpression compileExpression(String script, String varName, IType varType) throws ParseResultsException
- Throws:
ParseResultsException
-
compileExpression
public static IExpression compileExpression(String script, String varName, IType varType, String varName2, IType varType2) throws ParseResultsException
- Throws:
ParseResultsException
-
compileExpression
public static IExpression compileExpression(String script, ISymbolTable table) throws ParseResultsException
- Throws:
ParseResultsException
-
compileExpression
public static IExpression compileExpression(String script, ISymbolTable table, boolean bThrowOnWarning) throws ParseResultsException
- Throws:
ParseResultsException
-
compileExpression
public static IExpression compileExpression(String script, boolean bThrowOnWarning) throws ParseResultsException
- Throws:
ParseResultsException
-
compileProgram
public static IProgram compileProgram(String script, ISymbolTable table) throws ParseResultsException
- Throws:
ParseResultsException
-
assertHasErrors
public static void assertHasErrors(String strClass, ResourceKey... expected) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
assertHasErrors
public static void assertHasErrors(IGosuClass gsClass, ResourceKey... expected) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
assertOneError
public static void assertOneError(String strClass, ResourceKey errorKey) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
assertOneError
public static void assertOneError(IGosuClass gsClass, ResourceKey errorKey)
-
assertOneWarning
public static void assertOneWarning(String strClass, ResourceKey warningKey) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
assertOneWarning
public static void assertOneWarning(IGosuClass gsClass, ResourceKey warningKey)
-
getParseResultsException
public static ParseResultsException getParseResultsException(String script)
Gets the parse results exception caused by the given program. Throws an IllegalArgumentException if no parse exceptions are found.
-
assertCausesPRE
public static void assertCausesPRE(String script, ResourceKey... keys)
-
-