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


Java Asserts.assertTypeCollectionEquals方法代码示例

本文整理汇总了Java中com.google.javascript.rhino.testing.Asserts.assertTypeCollectionEquals方法的典型用法代码示例。如果您正苦于以下问题:Java Asserts.assertTypeCollectionEquals方法的具体用法?Java Asserts.assertTypeCollectionEquals怎么用?Java Asserts.assertTypeCollectionEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.javascript.rhino.testing.Asserts的用法示例。


在下文中一共展示了Asserts.assertTypeCollectionEquals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testStubProperty

import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testStubProperty() {
  testSame("function Foo() {}; Foo.bar;");
  ObjectType foo = (ObjectType) globalScope.getVar("Foo").getType();
  assertFalse(foo.hasProperty("bar"));
  Asserts.assertTypeEquals(registry.getNativeType(UNKNOWN_TYPE),
      foo.getPropertyType("bar"));
  Asserts.assertTypeCollectionEquals(
      Lists.newArrayList(foo), registry.getTypesWithProperty("bar"));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TypedScopeCreatorTest.java

示例2: testConstructorProperty

import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testConstructorProperty() {
  testSame("var foo = {}; /** @constructor */ foo.Bar = function() {};");
  ObjectType foo = (ObjectType) findNameType("foo", globalScope);
  assertTrue(foo.hasProperty("Bar"));
  assertFalse(foo.isPropertyTypeInferred("Bar"));

  JSType fooBar = foo.getPropertyType("Bar");
  assertEquals("function (new:foo.Bar): undefined", fooBar.toString());
  Asserts.assertTypeCollectionEquals(
      Lists.newArrayList(foo), registry.getTypesWithProperty("Bar"));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TypedScopeCreatorTest.java

示例3: testEnumProperty

import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testEnumProperty() {
  testSame("var foo = {}; /** @enum */ foo.Bar = {XXX: 'xxx'};");
  ObjectType foo = (ObjectType) findNameType("foo", globalScope);
  assertTrue(foo.hasProperty("Bar"));
  assertFalse(foo.isPropertyTypeInferred("Bar"));
  assertTrue(foo.isPropertyTypeDeclared("Bar"));

  JSType fooBar = foo.getPropertyType("Bar");
  assertEquals("enum{foo.Bar}", fooBar.toString());
  Asserts.assertTypeCollectionEquals(
      Lists.newArrayList(foo), registry.getTypesWithProperty("Bar"));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:TypedScopeCreatorTest.java

示例4: testGatherProperyWithoutAnnotation1

import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testGatherProperyWithoutAnnotation1() throws Exception {
  Node n = parseAndTypeCheck("/** @constructor */ var T = function() {};" +
      "/** @type {!T} */var t; t.x; t;");
  JSType type = n.getLastChild().getLastChild().getJSType();
  assertFalse(type.isUnknownType());
  assertTrue(type instanceof ObjectType);
  ObjectType objectType = (ObjectType) type;
  assertFalse(objectType.hasProperty("x"));
  Asserts.assertTypeCollectionEquals(
      Lists.newArrayList(objectType),
      registry.getTypesWithProperty("x"));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:LooseTypeCheckTest.java

示例5: testGatherProperyWithoutAnnotation2

import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testGatherProperyWithoutAnnotation2() throws Exception {
  TypeCheckResult ns =
      parseAndTypeCheckWithScope("/** @type {!Object} */var t; t.x; t;");
  Node n = ns.root;
  Scope s = ns.scope;
  JSType type = n.getLastChild().getLastChild().getJSType();
  assertFalse(type.isUnknownType());
  assertTypeEquals(type, OBJECT_TYPE);
  assertTrue(type instanceof ObjectType);
  ObjectType objectType = (ObjectType) type;
  assertFalse(objectType.hasProperty("x"));
  Asserts.assertTypeCollectionEquals(
      Lists.newArrayList(OBJECT_TYPE),
      registry.getTypesWithProperty("x"));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:LooseTypeCheckTest.java

示例6: testGatherProperyWithoutAnnotation2

import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testGatherProperyWithoutAnnotation2() throws Exception {
  TypeCheckResult ns =
      parseAndTypeCheckWithScope("/** @type {!Object} */var t; t.x; t;");
  Node n = ns.root;
  JSType type = n.getLastChild().getLastChild().getJSType();
  assertFalse(type.isUnknownType());
  assertTypeEquals(type, OBJECT_TYPE);
  assertTrue(type instanceof ObjectType);
  ObjectType objectType = (ObjectType) type;
  assertFalse(objectType.hasProperty("x"));
  Asserts.assertTypeCollectionEquals(
      Lists.newArrayList(OBJECT_TYPE),
      registry.getTypesWithProperty("x"));
}
 
开发者ID:nicks,项目名称:closure-compiler-old,代码行数:15,代码来源:LooseTypeCheckTest.java


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