Some tests on java.lang.Object added

This commit is contained in:
Alexey Andreev 2013-11-19 21:26:29 +04:00
parent f88b868c39
commit cf6c9b1ba6
2 changed files with 21 additions and 1 deletions

View File

@ -61,7 +61,9 @@ public class ObjectNativeGenerator implements Generator, DependencyPlugin {
ValueType.object(classClass)));
writer.append("cls = ").appendClass(classClass).append('.').appendMethod(createMethodRef)
.append("();").newLine();
writer.append("cls.$data = ").append(thisArg).append(".$class;").newLine().outdent().append("}").newLine();
writer.append("cls.$data = ").append(thisArg).append(".$class;").newLine();
writer.append(thisArg).append(".$class.classObject = cls;").newLine();
writer.outdent().append("}").newLine();
writer.append("return cls;").newLine();
}

View File

@ -27,4 +27,22 @@ class TObjectTests {
Object b = a;
assertEquals(a, b);
}
@Test
public void multipleGetClassCallsReturnSameValue() {
Object a = new Object();
assertSame(a.getClass(), a.getClass());
}
@Test
public void sameClassesAreEqual() {
Object a = new Object();
Object b = new Object();
assertSame(a.getClass(), b.getClass());
}
@Test
public void properInstanceDetected() {
assertTrue(Object.class.isInstance(new Object()));
}
}