本文整理汇总了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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}