Search in sources :

Example 1 with ThrowNode

use of com.oracle.truffle.api.test.TruffleExceptionTest.ThrowNode in project graal by oracle.

the class LegacyTruffleExceptionTest method testPolyglotStackTrace.

@Test
public void testPolyglotStackTrace() {
    setupEnv(Context.create(), new ProxyLanguage() {

        @Override
        protected CallTarget parse(TruffleLanguage.ParsingRequest request) throws Exception {
            ThrowNode throwNode = new ThrowNode((n) -> {
                return new LegacyCatchableException("Test exception", n);
            });
            return new TestRootNode(languageInstance, "test", null, throwNode).getCallTarget();
        }
    });
    assertFails(() -> context.eval(ProxyLanguage.ID, "Test"), PolyglotException.class, (pe) -> {
        TruffleExceptionTest.verifyStackTrace(pe, "<proxyLanguage> test", "(org.graalvm.sdk/)?org.graalvm.polyglot.Context.eval");
    });
}
Also used : TruffleObject(com.oracle.truffle.api.interop.TruffleObject) Node(com.oracle.truffle.api.nodes.Node) BeforeClass(org.junit.BeforeClass) ExportLibrary(com.oracle.truffle.api.library.ExportLibrary) PolyglotException(org.graalvm.polyglot.PolyglotException) ThrowNode(com.oracle.truffle.api.test.TruffleExceptionTest.ThrowNode) UnsupportedMessageException(com.oracle.truffle.api.interop.UnsupportedMessageException) Test(org.junit.Test) CallTarget(com.oracle.truffle.api.CallTarget) BlockNode(com.oracle.truffle.api.test.TruffleExceptionTest.BlockNode) AbstractPolyglotTest(com.oracle.truffle.api.test.polyglot.AbstractPolyglotTest) TestRootNode(com.oracle.truffle.api.test.TruffleExceptionTest.TestRootNode) ExceptionType(com.oracle.truffle.api.interop.ExceptionType) ProxyLanguage(com.oracle.truffle.api.test.polyglot.ProxyLanguage) ExportMessage(com.oracle.truffle.api.library.ExportMessage) InteropLibrary(com.oracle.truffle.api.interop.InteropLibrary) TruffleExceptionTest.createContext(com.oracle.truffle.api.test.TruffleExceptionTest.createContext) Context(org.graalvm.polyglot.Context) Assert(org.junit.Assert) TruffleLanguage(com.oracle.truffle.api.TruffleLanguage) TruffleTestAssumptions(com.oracle.truffle.tck.tests.TruffleTestAssumptions) TruffleExceptionTest.createAST(com.oracle.truffle.api.test.TruffleExceptionTest.createAST) Before(org.junit.Before) CallTarget(com.oracle.truffle.api.CallTarget) ThrowNode(com.oracle.truffle.api.test.TruffleExceptionTest.ThrowNode) TruffleLanguage(com.oracle.truffle.api.TruffleLanguage) TestRootNode(com.oracle.truffle.api.test.TruffleExceptionTest.TestRootNode) PolyglotException(org.graalvm.polyglot.PolyglotException) UnsupportedMessageException(com.oracle.truffle.api.interop.UnsupportedMessageException) ProxyLanguage(com.oracle.truffle.api.test.polyglot.ProxyLanguage) Test(org.junit.Test) AbstractPolyglotTest(com.oracle.truffle.api.test.polyglot.AbstractPolyglotTest)

Aggregations

CallTarget (com.oracle.truffle.api.CallTarget)1 TruffleLanguage (com.oracle.truffle.api.TruffleLanguage)1 ExceptionType (com.oracle.truffle.api.interop.ExceptionType)1 InteropLibrary (com.oracle.truffle.api.interop.InteropLibrary)1 TruffleObject (com.oracle.truffle.api.interop.TruffleObject)1 UnsupportedMessageException (com.oracle.truffle.api.interop.UnsupportedMessageException)1 ExportLibrary (com.oracle.truffle.api.library.ExportLibrary)1 ExportMessage (com.oracle.truffle.api.library.ExportMessage)1 Node (com.oracle.truffle.api.nodes.Node)1 BlockNode (com.oracle.truffle.api.test.TruffleExceptionTest.BlockNode)1 TestRootNode (com.oracle.truffle.api.test.TruffleExceptionTest.TestRootNode)1 ThrowNode (com.oracle.truffle.api.test.TruffleExceptionTest.ThrowNode)1 TruffleExceptionTest.createAST (com.oracle.truffle.api.test.TruffleExceptionTest.createAST)1 TruffleExceptionTest.createContext (com.oracle.truffle.api.test.TruffleExceptionTest.createContext)1 AbstractPolyglotTest (com.oracle.truffle.api.test.polyglot.AbstractPolyglotTest)1 ProxyLanguage (com.oracle.truffle.api.test.polyglot.ProxyLanguage)1 TruffleTestAssumptions (com.oracle.truffle.tck.tests.TruffleTestAssumptions)1 Context (org.graalvm.polyglot.Context)1 PolyglotException (org.graalvm.polyglot.PolyglotException)1 Assert (org.junit.Assert)1