Elide GraalVM25.6.0-elide.4
All types
Versions and modules

TruffleRunner.RunWithPolyglotRule

Javaclassin com.oracle.truffle.tcksince 0.27

public static final class TruffleRunner.RunWithPolyglotRule implements TestRule
Inheritance
  1. Object
  2. RunWithPolyglotRule
Implements
  • TestRule
Enclosing type
TruffleRunner

JUnit rule to run the tests in the context of a polyglot engine. This can be used as a ClassRule or as a Rule.

If used as ClassRule, a single context is created for all unit tests in this class, and all tests (and also other methods like BeforeClass, Before After and AfterClass) are executed in this context.

If used as Rule, a new context is created for each unit test. The Before and After actions are also executed in this context. No context is available in the BeforeClass and AfterClass methods.

Constructors2

RunWithPolyglotRule()No description.

RunWithPolyglotRule

since 0.27
public RunWithPolyglotRule()

No description.

RunWithPolyglotRule(Context.Builder)No description.

RunWithPolyglotRule

since 19.0
public RunWithPolyglotRule(Context.Builder contextBuilder)

No description.

Parameters

contextBuilderContext.Builder
a custom context builder

Methods4

Statement apply(Statement, Description)

apply

since 0.27
public Statement apply(Statement stmt, Description description)

Internal method used by the JUnit framework. Do not call directly.

Parameters

stmtStatement
No description.
descriptionDescription
No description.

Returns

Statement
No description.

Overrides apply(org.junit.runners.model.Statement,org.junit.runner.Description).

Context getPolyglotContext()

getPolyglotContext

since 0.27
public Context getPolyglotContext()

Get the current Context. This should only be called from code that is executed by the TruffleRunner. In particular, this method can not be called from static initializers and constructors of test classes. Use Before or BeforeClass methods instead, or put the initialization code into the constructor of the RootNode of the test.

Returns

Context
No description.
TruffleLanguage.Env getTruffleTestEnv()

getTruffleTestEnv

since 0.27
public TruffleLanguage.Env getTruffleTestEnv()

Get an environment to access the polyglot engine using interop. This can be used to run setup tasks, and to do mock interop access into the polyglot engine. This should only be called from code that is executed by the TruffleRunner. In particular, this method can not be called from static initializers and constructors of test classes. Use Before or BeforeClass methods instead, or put the initialization code into the constructor of the RootNode of the test.

Returns

TruffleLanguage.Env
No description.
TruffleLanguage<?> getTestLanguage()

getTestLanguage

since 21.1
public TruffleLanguage<?> getTestLanguage()

Get an instance of the TruffleLanguage that this test is running under. Nodes that are used with Inject should pass this instance to their super constructor.

Returns

TruffleLanguage<?>
No description.

Inherited members