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 void
assertCausesPRE(String script, ResourceKey... keys)
static void
assertHasErrors(IGosuClass gsClass, ResourceKey... expected)
static void
assertHasErrors(String strClass, ResourceKey... expected)
static void
assertOneError(IGosuClass gsClass, ResourceKey errorKey)
static void
assertOneError(String strClass, ResourceKey errorKey)
static void
assertOneWarning(IGosuClass gsClass, ResourceKey warningKey)
static void
assertOneWarning(String strClass, ResourceKey warningKey)
static IExpression
compileExpression(String script)
static IExpression
compileExpression(String script, boolean bThrowOnWarning)
static IExpression
compileExpression(String script, ISymbolTable table)
static IExpression
compileExpression(String script, ISymbolTable table, boolean bThrowOnWarning)
static IExpression
compileExpression(String script, String varName, IType varType)
static IExpression
compileExpression(String script, String varName, IType varType, String varName2, IType varType2)
static IProgram
compileProgram(String script, ISymbolTable table)
static Object
eval(String script)
static Object
eval(String script, String name1, Object val1)
static Object
evalGosu(String script)
Evaluates the given Gosu.static Object
evalGosu(String script, ISymbolTable table)
static Object
evalGosu(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 Object
evalGosu(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 Object
evalGosu(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 Object
evalGosu(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 Object
evalGosu(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 Object
evalGosu(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 ParseResultsException
getParseResultsException(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)
-
-