本文整理汇总了Java中com.google.javascript.rhino.testing.Asserts.assertValidResolve方法的典型用法代码示例。如果您正苦于以下问题:Java Asserts.assertValidResolve方法的具体用法?Java Asserts.assertValidResolve怎么用?Java Asserts.assertValidResolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.testing.Asserts
的用法示例。
在下文中一共展示了Asserts.assertValidResolve方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNamedGoogBar
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
/**
* Tests the named type goog.Bar.
*/
public void testNamedGoogBar() throws Exception {
// isXxx
assertFalse(namedGoogBar.isFunctionPrototypeType());
assertTrue(namedGoogBar.getImplicitPrototype().isFunctionPrototypeType());
// canAssignTo
assertTrue(namedGoogBar.canAssignTo(ALL_TYPE));
assertFalse(namedGoogBar.canAssignTo(STRING_OBJECT_TYPE));
assertFalse(namedGoogBar.canAssignTo(NUMBER_TYPE));
assertFalse(namedGoogBar.canAssignTo(functionType));
assertFalse(namedGoogBar.canAssignTo(NULL_TYPE));
assertTrue(namedGoogBar.canAssignTo(OBJECT_TYPE));
assertFalse(namedGoogBar.canAssignTo(DATE_TYPE));
assertTrue(namedGoogBar.canAssignTo(namedGoogBar));
assertTrue(namedGoogBar.canAssignTo(unresolvedNamedType));
assertFalse(namedGoogBar.canAssignTo(REGEXP_TYPE));
assertFalse(namedGoogBar.canAssignTo(ARRAY_TYPE));
// autoboxesTo
assertNull(namedGoogBar.autoboxesTo());
// properties
assertEquals(DATE_TYPE, namedGoogBar.getPropertyType("date"));
assertFalse(namedGoogBar.isNativeObjectType());
assertFalse(namedGoogBar.getImplicitPrototype().isNativeObjectType());
JSType resolvedNamedGoogBar = Asserts.assertValidResolve(namedGoogBar);
assertNotSame(resolvedNamedGoogBar, namedGoogBar);
assertSame(resolvedNamedGoogBar, googBar.getInstanceType());
}
示例2: testNamedTypeEquals2
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
/**
* Tests the {@link NamedType#equals} function against other types.
*/
public void testNamedTypeEquals2() {
// test == if references are equal
NamedType a = new NamedType(registry, "typeA", "source", 1, 0);
NamedType b = new NamedType(registry, "typeB", "source", 1, 0);
ObjectType realA = registry.createConstructorType(
"typeA", null, null, null).getInstanceType();
ObjectType realB = registry.createEnumType(
"typeB", NUMBER_TYPE).getElementsType();
registry.declareType("typeA", realA);
registry.declareType("typeB", realB);
assertEquals(a.hashCode(), realA.hashCode());
assertEquals(a, realA);
assertEquals(b.hashCode(), realB.hashCode());
assertEquals(b, realB);
a.resolve(null, null);
b.resolve(null, null);
assertTrue(a.isResolved());
assertTrue(b.isResolved());
assertEquals(a.hashCode(), realA.hashCode());
assertEquals(a, realA);
assertEquals(b.hashCode(), realB.hashCode());
assertEquals(b, realB);
JSType resolvedA = Asserts.assertValidResolve(a);
assertNotSame(resolvedA, a);
assertSame(resolvedA, realA);
JSType resolvedB = Asserts.assertValidResolve(b);
assertNotSame(resolvedB, b);
assertSame(resolvedB, realB);
}
示例3: testNamedGoogBar
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
/**
* Tests the named type goog.Bar.
*/
public void testNamedGoogBar() throws Exception {
// isXxx
assertFalse(namedGoogBar.isFunctionPrototypeType());
assertTrue(namedGoogBar.getImplicitPrototype().isFunctionPrototypeType());
// canAssignTo
assertTrue(namedGoogBar.canAssignTo(ALL_TYPE));
assertFalse(namedGoogBar.canAssignTo(STRING_OBJECT_TYPE));
assertFalse(namedGoogBar.canAssignTo(NUMBER_TYPE));
assertFalse(namedGoogBar.canAssignTo(functionType));
assertFalse(namedGoogBar.canAssignTo(NULL_TYPE));
assertTrue(namedGoogBar.canAssignTo(OBJECT_TYPE));
assertFalse(namedGoogBar.canAssignTo(DATE_TYPE));
assertTrue(namedGoogBar.canAssignTo(namedGoogBar));
assertTrue(namedGoogBar.canAssignTo(unresolvedNamedType));
assertFalse(namedGoogBar.canAssignTo(REGEXP_TYPE));
assertFalse(namedGoogBar.canAssignTo(ARRAY_TYPE));
// autoboxesTo
assertNull(namedGoogBar.autoboxesTo());
// properties
assertTypeEquals(DATE_TYPE, namedGoogBar.getPropertyType("date"));
assertFalse(namedGoogBar.isNativeObjectType());
assertFalse(namedGoogBar.getImplicitPrototype().isNativeObjectType());
JSType resolvedNamedGoogBar = Asserts.assertValidResolve(namedGoogBar);
assertNotSame(resolvedNamedGoogBar, namedGoogBar);
assertSame(resolvedNamedGoogBar, googBar.getInstanceType());
}
示例4: testNamedTypeEquals2
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
/**
* Tests the {@link NamedType#equals} function against other types.
*/
public void testNamedTypeEquals2() {
// test == if references are equal
NamedType a = new NamedType(registry, "typeA", "source", 1, 0);
NamedType b = new NamedType(registry, "typeB", "source", 1, 0);
ObjectType realA = registry.createConstructorType(
"typeA", null, null, null).getInstanceType();
ObjectType realB = registry.createEnumType(
"typeB", NUMBER_TYPE).getElementsType();
registry.declareType("typeA", realA);
registry.declareType("typeB", realB);
assertEquals(a.hashCode(), realA.hashCode());
assertTypeEquals(a, realA);
assertEquals(b.hashCode(), realB.hashCode());
assertTypeEquals(b, realB);
a.resolve(null, null);
b.resolve(null, null);
assertTrue(a.isResolved());
assertTrue(b.isResolved());
assertEquals(a.hashCode(), realA.hashCode());
assertTypeEquals(a, realA);
assertEquals(b.hashCode(), realB.hashCode());
assertTypeEquals(b, realB);
JSType resolvedA = Asserts.assertValidResolve(a);
assertNotSame(resolvedA, a);
assertSame(resolvedA, realA);
JSType resolvedB = Asserts.assertValidResolve(b);
assertNotSame(resolvedB, b);
assertSame(resolvedB, realB);
}
示例5: testNamedGoogBar
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
/**
* Tests the named type goog.Bar.
*/
public void testNamedGoogBar() throws Exception {
// isXxx
assertFalse(namedGoogBar.isFunctionPrototypeType());
assertTrue(namedGoogBar.getImplicitPrototype().isFunctionPrototypeType());
// isSubtype
assertTrue(namedGoogBar.isSubtype(ALL_TYPE));
assertFalse(namedGoogBar.isSubtype(STRING_OBJECT_TYPE));
assertFalse(namedGoogBar.isSubtype(NUMBER_TYPE));
assertFalse(namedGoogBar.isSubtype(functionType));
assertFalse(namedGoogBar.isSubtype(NULL_TYPE));
assertTrue(namedGoogBar.isSubtype(OBJECT_TYPE));
assertFalse(namedGoogBar.isSubtype(DATE_TYPE));
assertTrue(namedGoogBar.isSubtype(namedGoogBar));
assertTrue(namedGoogBar.isSubtype(unresolvedNamedType));
assertFalse(namedGoogBar.isSubtype(REGEXP_TYPE));
assertFalse(namedGoogBar.isSubtype(ARRAY_TYPE));
// autoboxesTo
assertNull(namedGoogBar.autoboxesTo());
// properties
assertTypeEquals(DATE_TYPE, namedGoogBar.getPropertyType("date"));
assertFalse(namedGoogBar.isNativeObjectType());
assertFalse(namedGoogBar.getImplicitPrototype().isNativeObjectType());
JSType resolvedNamedGoogBar = Asserts.assertValidResolve(namedGoogBar);
assertNotSame(resolvedNamedGoogBar, namedGoogBar);
assertSame(resolvedNamedGoogBar, googBar.getInstanceType());
}
示例6: testNamedTypeEquals2
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
/**
* Tests the {@link NamedType#equals} function against other types.
*/
public void testNamedTypeEquals2() {
// test == if references are equal
NamedType a = new NamedType(registry, "typeA", "source", 1, 0);
NamedType b = new NamedType(registry, "typeB", "source", 1, 0);
ObjectType realA = registry.createConstructorType(
"typeA", null, null, null, null).getInstanceType();
ObjectType realB = registry.createEnumType(
"typeB", null, NUMBER_TYPE).getElementsType();
registry.declareType("typeA", realA);
registry.declareType("typeB", realB);
assertTypeEquals(a, realA);
assertTypeEquals(b, realB);
a.resolve(null, null);
b.resolve(null, null);
assertTrue(a.isResolved());
assertTrue(b.isResolved());
assertTypeEquals(a, realA);
assertTypeEquals(b, realB);
JSType resolvedA = Asserts.assertValidResolve(a);
assertNotSame(resolvedA, a);
assertSame(resolvedA, realA);
JSType resolvedB = Asserts.assertValidResolve(b);
assertNotSame(resolvedB, b);
assertSame(resolvedB, realB);
}
示例7: testNamedTypeEquals2
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
/**
* Tests the {@link NamedType#equals} function against other types.
*/
public void testNamedTypeEquals2() {
// test == if references are equal
NamedType a = new NamedType(registry, "typeA", "source", 1, 0);
NamedType b = new NamedType(registry, "typeB", "source", 1, 0);
ObjectType realA =
registry.createConstructorType("typeA", null, null, null, null, false).getInstanceType();
ObjectType realB = registry.createEnumType(
"typeB", null, NUMBER_TYPE).getElementsType();
registry.declareType("typeA", realA);
registry.declareType("typeB", realB);
assertTypeEquals(a, realA);
assertTypeEquals(b, realB);
a.resolve(null, null);
b.resolve(null, null);
assertTrue(a.isResolved());
assertTrue(b.isResolved());
assertTypeEquals(a, realA);
assertTypeEquals(b, realB);
JSType resolvedA = Asserts.assertValidResolve(a);
assertNotSame(resolvedA, a);
assertSame(resolvedA, realA);
JSType resolvedB = Asserts.assertValidResolve(b);
assertNotSame(resolvedB, b);
assertSame(resolvedB, realB);
}