Class BaseJSTypeTestCase
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- com.google.javascript.rhino.testing.BaseJSTypeTestCase
-
- All Implemented Interfaces:
junit.framework.Test
public abstract class BaseJSTypeTestCase extends junit.framework.TestCase
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BaseJSTypeTestCase()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addNativeProperties(JSTypeRegistry registry)
Adds a basic set of properties to the native types.protected void
assertTypeEquals(JSType a, JSType b)
protected void
assertTypeEquals(JSType expected, JSTypeExpression actual)
Asserts that a a type expression resolves to the correctJSType
.protected void
assertTypeEquals(JSType expected, Node actual)
Asserts that a Node representing a type expression resolves to the correctJSType
.protected void
assertTypeEquals(java.lang.String msg, JSType a, JSType b)
protected void
assertTypeNotEquals(JSType a, JSType b)
protected void
assertTypeNotEquals(java.lang.String msg, JSType a, JSType b)
protected JSType
createNullableType(JSType type)
protected JSType
createOptionalType(JSType type)
protected RecordTypeBuilder
createRecordTypeBuilder()
protected TemplatizedType
createTemplatizedType(ObjectType baseType, com.google.common.collect.ImmutableList<JSType> templatizedTypes)
protected TemplatizedType
createTemplatizedType(ObjectType baseType, JSType... templatizedType)
protected JSType
createUnionType(JSType... variants)
protected void
initTypes()
protected JSType
resolve(JSTypeExpression n, java.lang.String... warnings)
Resolves a type expression, expecting the given warnings.protected void
setUp()
-
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, tearDown, toString
-
-
-
-
Field Detail
-
registry
protected JSTypeRegistry registry
-
errorReporter
protected TestErrorReporter errorReporter
-
ALL_TYPE
protected JSType ALL_TYPE
-
NO_OBJECT_TYPE
protected ObjectType NO_OBJECT_TYPE
-
NO_TYPE
protected ObjectType NO_TYPE
-
NO_RESOLVED_TYPE
protected ObjectType NO_RESOLVED_TYPE
-
ARRAY_FUNCTION_TYPE
protected FunctionType ARRAY_FUNCTION_TYPE
-
ARRAY_TYPE
protected ObjectType ARRAY_TYPE
-
BOOLEAN_OBJECT_FUNCTION_TYPE
protected JSType BOOLEAN_OBJECT_FUNCTION_TYPE
-
BOOLEAN_OBJECT_TYPE
protected ObjectType BOOLEAN_OBJECT_TYPE
-
BOOLEAN_TYPE
protected JSType BOOLEAN_TYPE
-
CHECKED_UNKNOWN_TYPE
protected ObjectType CHECKED_UNKNOWN_TYPE
-
DATE_FUNCTION_TYPE
protected JSType DATE_FUNCTION_TYPE
-
DATE_TYPE
protected ObjectType DATE_TYPE
-
ERROR_FUNCTION_TYPE
protected JSType ERROR_FUNCTION_TYPE
-
ERROR_TYPE
protected ObjectType ERROR_TYPE
-
EVAL_ERROR_FUNCTION_TYPE
protected JSType EVAL_ERROR_FUNCTION_TYPE
-
EVAL_ERROR_TYPE
protected ObjectType EVAL_ERROR_TYPE
-
FUNCTION_FUNCTION_TYPE
protected FunctionType FUNCTION_FUNCTION_TYPE
-
FUNCTION_INSTANCE_TYPE
protected FunctionType FUNCTION_INSTANCE_TYPE
-
FUNCTION_PROTOTYPE
protected ObjectType FUNCTION_PROTOTYPE
-
GREATEST_FUNCTION_TYPE
protected JSType GREATEST_FUNCTION_TYPE
-
LEAST_FUNCTION_TYPE
protected JSType LEAST_FUNCTION_TYPE
-
MATH_TYPE
protected JSType MATH_TYPE
-
NULL_TYPE
protected JSType NULL_TYPE
-
NUMBER_OBJECT_FUNCTION_TYPE
protected JSType NUMBER_OBJECT_FUNCTION_TYPE
-
NUMBER_OBJECT_TYPE
protected ObjectType NUMBER_OBJECT_TYPE
-
NUMBER_STRING_BOOLEAN
protected JSType NUMBER_STRING_BOOLEAN
-
NUMBER_TYPE
protected JSType NUMBER_TYPE
-
OBJECT_FUNCTION_TYPE
protected FunctionType OBJECT_FUNCTION_TYPE
-
NULL_VOID
protected JSType NULL_VOID
-
OBJECT_NUMBER_STRING
protected JSType OBJECT_NUMBER_STRING
-
OBJECT_NUMBER_STRING_BOOLEAN
protected JSType OBJECT_NUMBER_STRING_BOOLEAN
-
OBJECT_PROTOTYPE
protected JSType OBJECT_PROTOTYPE
-
OBJECT_TYPE
protected ObjectType OBJECT_TYPE
-
RANGE_ERROR_FUNCTION_TYPE
protected JSType RANGE_ERROR_FUNCTION_TYPE
-
RANGE_ERROR_TYPE
protected ObjectType RANGE_ERROR_TYPE
-
REFERENCE_ERROR_FUNCTION_TYPE
protected JSType REFERENCE_ERROR_FUNCTION_TYPE
-
REFERENCE_ERROR_TYPE
protected ObjectType REFERENCE_ERROR_TYPE
-
REGEXP_FUNCTION_TYPE
protected JSType REGEXP_FUNCTION_TYPE
-
REGEXP_TYPE
protected ObjectType REGEXP_TYPE
-
STRING_OBJECT_FUNCTION_TYPE
protected JSType STRING_OBJECT_FUNCTION_TYPE
-
STRING_OBJECT_TYPE
protected ObjectType STRING_OBJECT_TYPE
-
STRING_TYPE
protected JSType STRING_TYPE
-
SYNTAX_ERROR_FUNCTION_TYPE
protected JSType SYNTAX_ERROR_FUNCTION_TYPE
-
SYNTAX_ERROR_TYPE
protected ObjectType SYNTAX_ERROR_TYPE
-
TYPE_ERROR_FUNCTION_TYPE
protected JSType TYPE_ERROR_FUNCTION_TYPE
-
TYPE_ERROR_TYPE
protected ObjectType TYPE_ERROR_TYPE
-
U2U_CONSTRUCTOR_TYPE
protected FunctionType U2U_CONSTRUCTOR_TYPE
-
U2U_FUNCTION_TYPE
protected FunctionType U2U_FUNCTION_TYPE
-
UNKNOWN_TYPE
protected ObjectType UNKNOWN_TYPE
-
URI_ERROR_FUNCTION_TYPE
protected JSType URI_ERROR_FUNCTION_TYPE
-
URI_ERROR_TYPE
protected ObjectType URI_ERROR_TYPE
-
VOID_TYPE
protected JSType VOID_TYPE
-
NATIVE_PROPERTIES_COUNT
protected int NATIVE_PROPERTIES_COUNT
-
ALL_NATIVE_EXTERN_TYPES
public static final java.lang.String ALL_NATIVE_EXTERN_TYPES
A definition of all extern types. This should be kept in sync with javascript/externs/es3.js. This is used to check that the built-in types declared inJSTypeRegistry
have the same type as that in the externs. It can also be used for any tests that want to use built-in types in their externs.- See Also:
- Constant Field Values
-
-
Method Detail
-
setUp
protected void setUp() throws java.lang.Exception
- Overrides:
setUp
in classjunit.framework.TestCase
- Throws:
java.lang.Exception
-
initTypes
protected void initTypes()
-
addNativeProperties
public static void addNativeProperties(JSTypeRegistry registry)
Adds a basic set of properties to the native types.
-
createRecordTypeBuilder
protected RecordTypeBuilder createRecordTypeBuilder()
-
createTemplatizedType
protected TemplatizedType createTemplatizedType(ObjectType baseType, com.google.common.collect.ImmutableList<JSType> templatizedTypes)
-
createTemplatizedType
protected TemplatizedType createTemplatizedType(ObjectType baseType, JSType... templatizedType)
-
assertTypeEquals
protected void assertTypeEquals(JSType expected, Node actual)
Asserts that a Node representing a type expression resolves to the correctJSType
.
-
assertTypeEquals
protected void assertTypeEquals(JSType expected, JSTypeExpression actual)
Asserts that a a type expression resolves to the correctJSType
.
-
resolve
protected JSType resolve(JSTypeExpression n, java.lang.String... warnings)
Resolves a type expression, expecting the given warnings.
-
-