@Test public void testFortyTwo() throws Exception { TruffleVM.Symbol fourtyTwo = findGlobalSymbol(fourtyTwo()); Object res = fourtyTwo.invoke(null); assert res instanceof Number : "should yield a number, but was: " + res; Number n = (Number) res; assert 42 == n.intValue() : "The value is 42 = " + n.intValue(); }
/** @since 0.8 or earlier */ @Test public void testFortyTwo() throws Exception { PolyglotEngine.Value fourtyTwo = findGlobalSymbol(fourtyTwo()); Object res = fourtyTwo.execute().get(); assert res instanceof Number : "should yield a number, but was: " + res; Number n = (Number) res; assert 42 == n.intValue() : "The value is 42 = " + n.intValue(); }