use of com.google.javascript.rhino.testing.TestErrorReporter in project closure-compiler by google.
the class NodeTest method testSerializeProperties_typeBeforeCast.
@Test
public void testSerializeProperties_typeBeforeCast() {
TestErrorReporter testErrorReporter = new TestErrorReporter();
JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
Node node = Node.newString(Token.NAME, "f");
node.setJSTypeBeforeCast(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
EnumSet<NodeProperty> result = node.serializeProperties();
// Special case: Rhino node prop TYPE_BEFORE_CAST is converted to NodeProperty.COLOR_FROM_CAST
assertThat(result).containsExactly(NodeProperty.COLOR_FROM_CAST);
}
use of com.google.javascript.rhino.testing.TestErrorReporter in project closure-compiler by google.
the class NodeTest method testCheckTreeTypeAwareEqualsDifferent.
@Test
public void testCheckTreeTypeAwareEqualsDifferent() {
TestErrorReporter testErrorReporter = new TestErrorReporter();
JSTypeRegistry registry = new JSTypeRegistry(testErrorReporter);
Node node1 = Node.newString(Token.NAME, "f");
node1.setJSType(registry.getNativeType(JSTypeNative.NUMBER_TYPE));
Node node2 = Node.newString(Token.NAME, "f");
node2.setJSType(registry.getNativeType(JSTypeNative.STRING_TYPE));
assertThat(node1.isEquivalentToTyped(node2)).isFalse();
testErrorReporter.verifyHasEncounteredAllWarningsAndErrors();
}
Aggregations