Package gw.util

Class GosuTestUtil


  • public class GosuTestUtil
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.Object[] EMPTY_OBJECT_ARR  
    • Constructor Summary

      Constructors 
      Constructor Description
      GosuTestUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void assertCausesPRE​(java.lang.String script, ResourceKey... keys)  
      static void assertHasErrors​(IGosuClass gsClass, ResourceKey... expected)  
      static void assertHasErrors​(java.lang.String strClass, ResourceKey... expected)  
      static void assertOneError​(IGosuClass gsClass, ResourceKey errorKey)  
      static void assertOneError​(java.lang.String strClass, ResourceKey errorKey)  
      static void assertOneWarning​(IGosuClass gsClass, ResourceKey warningKey)  
      static void assertOneWarning​(java.lang.String strClass, ResourceKey warningKey)  
      static IExpression compileExpression​(java.lang.String script)  
      static IExpression compileExpression​(java.lang.String script, boolean bThrowOnWarning)  
      static IExpression compileExpression​(java.lang.String script, ISymbolTable table)  
      static IExpression compileExpression​(java.lang.String script, ISymbolTable table, boolean bThrowOnWarning)  
      static IExpression compileExpression​(java.lang.String script, java.lang.String varName, IType varType)  
      static IExpression compileExpression​(java.lang.String script, java.lang.String varName, IType varType, java.lang.String varName2, IType varType2)  
      static IProgram compileProgram​(java.lang.String script, ISymbolTable table)  
      static java.lang.Object eval​(java.lang.String script)  
      static java.lang.Object eval​(java.lang.String script, java.lang.String name1, java.lang.Object val1)  
      static java.lang.Object evalGosu​(java.lang.String script)
      Evaluates the given Gosu.
      static java.lang.Object evalGosu​(java.lang.String script, ISymbolTable table)  
      static java.lang.Object evalGosu​(java.lang.String script, java.lang.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 java.lang.Object evalGosu​(java.lang.String script, java.lang.String name1, java.lang.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 java.lang.Object evalGosu​(java.lang.String script, java.lang.String name1, java.lang.Object val1, java.lang.String name2, java.lang.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 java.lang.Object evalGosu​(java.lang.String script, java.lang.String name1, java.lang.Object val1, java.lang.String name2, java.lang.Object val2, java.lang.String name3, java.lang.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 java.lang.Object evalGosu​(java.lang.String script, java.lang.String name1, java.lang.Object val1, java.lang.String name2, java.lang.Object val2, java.lang.String name3, java.lang.Object val3, java.lang.String name4, java.lang.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 java.lang.Object evalGosu​(java.lang.String script, java.lang.String name1, java.lang.Object val1, java.lang.String name2, java.lang.Object val2, java.lang.String name3, java.lang.Object val3, java.lang.String name4, java.lang.Object val4, java.lang.String name5, java.lang.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​(java.lang.String script)
      Gets the parse results exception caused by the given program.
      private static IGosuClass loadClass​(java.lang.String strClass)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • EMPTY_OBJECT_ARR

        private static final java.lang.Object[] EMPTY_OBJECT_ARR
    • Constructor Detail

      • GosuTestUtil

        public GosuTestUtil()
    • Method Detail

      • eval

        public static java.lang.Object eval​(java.lang.String script)
      • eval

        public static java.lang.Object eval​(java.lang.String script,
                                            java.lang.String name1,
                                            java.lang.Object val1)
      • evalGosu

        public static java.lang.Object evalGosu​(java.lang.String script,
                                                java.lang.String name1,
                                                java.lang.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 java.lang.Object evalGosu​(java.lang.String script,
                                                java.lang.String name1,
                                                java.lang.Object val1,
                                                java.lang.String name2,
                                                java.lang.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 java.lang.Object evalGosu​(java.lang.String script,
                                                java.lang.String name1,
                                                java.lang.Object val1,
                                                java.lang.String name2,
                                                java.lang.Object val2,
                                                java.lang.String name3,
                                                java.lang.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 java.lang.Object evalGosu​(java.lang.String script,
                                                java.lang.String name1,
                                                java.lang.Object val1,
                                                java.lang.String name2,
                                                java.lang.Object val2,
                                                java.lang.String name3,
                                                java.lang.Object val3,
                                                java.lang.String name4,
                                                java.lang.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 java.lang.Object evalGosu​(java.lang.String script,
                                                java.lang.String name1,
                                                java.lang.Object val1,
                                                java.lang.String name2,
                                                java.lang.Object val2,
                                                java.lang.String name3,
                                                java.lang.Object val3,
                                                java.lang.String name4,
                                                java.lang.Object val4,
                                                java.lang.String name5,
                                                java.lang.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 java.lang.Object evalGosu​(java.lang.String script,
                                                java.lang.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
      • assertHasErrors

        public static void assertHasErrors​(java.lang.String strClass,
                                           ResourceKey... expected)
                                    throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • loadClass

        private static IGosuClass loadClass​(java.lang.String strClass)
      • assertHasErrors

        public static void assertHasErrors​(IGosuClass gsClass,
                                           ResourceKey... expected)
                                    throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • assertOneError

        public static void assertOneError​(java.lang.String strClass,
                                          ResourceKey errorKey)
                                   throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • assertOneWarning

        public static void assertOneWarning​(java.lang.String strClass,
                                            ResourceKey warningKey)
                                     throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException
      • assertOneWarning

        public static void assertOneWarning​(IGosuClass gsClass,
                                            ResourceKey warningKey)
      • getParseResultsException

        public static ParseResultsException getParseResultsException​(java.lang.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​(java.lang.String script,
                                           ResourceKey... keys)