当前位置: 首页>>代码示例>>Java>>正文


Java Asserts.assertValidResolve方法代码示例

本文整理汇总了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());
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:35,代码来源:JSTypeTest.java

示例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);
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:39,代码来源:JSTypeTest.java

示例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());
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:35,代码来源:JSTypeTest.java

示例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);
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:39,代码来源:JSTypeTest.java

示例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());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:JSTypeTest.java

示例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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:35,代码来源:JSTypeTest.java

示例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);
}
 
开发者ID:google,项目名称:closure-compiler,代码行数:35,代码来源:JSTypeTest.java


注:本文中的com.google.javascript.rhino.testing.Asserts.assertValidResolve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。