use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class NullArrayNFITest method testNullArray.
@Test
public void testNullArray(@Inject(NullArrayNode.class) CallTarget target) {
Object ret = target.call(new NullObject());
Assert.assertThat("return value", ret, is(instanceOf(TruffleObject.class)));
TruffleObject obj = (TruffleObject) ret;
Assert.assertTrue("isBoxed", isBoxed(obj));
Assert.assertEquals("return value", "null", unbox(obj));
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class NullNFITest method testNullCallbackArg.
@Test
public void testNullCallbackArg(@Inject(TestNullCallbackArgNode.class) CallTarget callTarget) {
TruffleObject nullCallback = new TestCallback(1, (args) -> {
Assert.assertThat("callback argument", args[0], is(instanceOf(TruffleObject.class)));
Assert.assertTrue("isNull", isNull((TruffleObject) args[0]));
return null;
});
callTarget.call(nullCallback);
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class NullNFITest method testNullRet.
@Test
public void testNullRet(@Inject(TestNullRetNode.class) CallTarget callTarget) {
Object ret = callTarget.call();
Assert.assertThat("return value", ret, is(instanceOf(TruffleObject.class)));
TruffleObject obj = (TruffleObject) ret;
Assert.assertTrue("isNull", isNull(obj));
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class NullNFITest method testNullArg.
@Test
public void testNullArg(@Inject(TestNullArgNode.class) CallTarget callTarget) {
String expected = getExpected();
Object ret = callTarget.call(new NullObject());
Assert.assertThat("return value", ret, is(instanceOf(TruffleObject.class)));
TruffleObject obj = (TruffleObject) ret;
Assert.assertTrue("isBoxed", isBoxed(obj));
Assert.assertEquals("return value", expected, unbox(obj));
}
use of com.oracle.truffle.api.interop.TruffleObject in project graal by oracle.
the class NullNFITest method testNullCallbackRet.
@Test
public void testNullCallbackRet(@Inject(TestNullCallbackRetNode.class) CallTarget callTarget) {
String expected = getExpected();
TruffleObject nullCallback = new TestCallback(0, (args) -> {
return new NullObject();
});
Object ret = callTarget.call(nullCallback);
Assert.assertThat("return value", ret, is(instanceOf(TruffleObject.class)));
TruffleObject obj = (TruffleObject) ret;
Assert.assertTrue("isBoxed", isBoxed(obj));
Assert.assertEquals("return value", expected, unbox(obj));
}
Aggregations