本文整理汇总了Java中com.google.javascript.rhino.testing.Asserts.assertEquivalenceOperations方法的典型用法代码示例。如果您正苦于以下问题:Java Asserts.assertEquivalenceOperations方法的具体用法?Java Asserts.assertEquivalenceOperations怎么用?Java Asserts.assertEquivalenceOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.testing.Asserts
的用法示例。
在下文中一共展示了Asserts.assertEquivalenceOperations方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRecursiveRecord
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testRecursiveRecord() {
ProxyObjectType loop = new ProxyObjectType(registry, NUMBER_TYPE);
JSType record = new RecordTypeBuilder(registry)
.addProperty("loop", loop, null)
.addProperty("number", NUMBER_TYPE, null)
.addProperty("string", STRING_TYPE, null)
.build();
assertEquals("{loop: number, number: number, string: string}",
record.toString());
loop.setReferencedType(record);
assertEquals("{loop: {...}, number: number, string: string}",
record.toString());
assertEquals("{loop: ?, number: number, string: string}",
record.toAnnotationString());
Asserts.assertEquivalenceOperations(record, loop);
}
示例2: testIsEquivalentToParams
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testIsEquivalentToParams() {
FunctionType oneNum = new FunctionBuilder(registry)
.withParamsNode(registry.createParameters(NUMBER_TYPE))
.build();
FunctionType optNum = new FunctionBuilder(registry)
.withParamsNode(registry.createOptionalParameters(NUMBER_TYPE))
.build();
FunctionType varNum = new FunctionBuilder(registry)
.withParamsNode(registry.createParametersWithVarArgs(NUMBER_TYPE))
.build();
Asserts.assertEquivalenceOperations(oneNum, oneNum);
Asserts.assertEquivalenceOperations(optNum, optNum);
Asserts.assertEquivalenceOperations(varNum, varNum);
assertFalse(oneNum.isEquivalentTo(optNum));
assertFalse(oneNum.isEquivalentTo(varNum));
assertFalse(optNum.isEquivalentTo(varNum));
}
示例3: testRecursiveRecord
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testRecursiveRecord() {
ProxyObjectType loop = new ProxyObjectType(registry, NUMBER_TYPE);
JSType record = new RecordTypeBuilder(registry)
.addProperty("loop", loop, null)
.addProperty("number", NUMBER_TYPE, null)
.addProperty("string", STRING_TYPE, null)
.build();
assertEquals("{\n loop: number,\n number: number,\n string: string\n}",
record.toString());
loop.setReferencedType(record);
assertEquals("{\n loop: {...},\n number: number,\n string: string\n}",
record.toString());
assertEquals("{loop: ?, number: number, string: string}",
record.toAnnotationString(Nullability.EXPLICIT));
Asserts.assertEquivalenceOperations(record, loop);
}
示例4: testRecursiveFunction
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testRecursiveFunction() {
ProxyObjectType loop = new ProxyObjectType(registry, NUMBER_TYPE);
FunctionType fn = new FunctionBuilder(registry)
.withParamsNode(registry.createParameters(loop))
.withReturnType(loop).build();
loop.setReferencedType(fn);
assertEquals("function (Function): Function", fn.toString());
Asserts.assertEquivalenceOperations(fn, loop);
}
示例5: testRecursiveFunction
import com.google.javascript.rhino.testing.Asserts; //导入方法依赖的package包/类
public void testRecursiveFunction() {
ProxyObjectType loop = new ProxyObjectType(registry, NUMBER_TYPE);
FunctionType fn = new FunctionBuilder(registry)
.withParamsNode(registry.createParameters(loop))
.withReturnType(loop).build();
loop.setReferencedType(fn);
assertEquals("function(Function): Function", fn.toString());
Asserts.assertEquivalenceOperations(fn, loop);
}