Package org.graalvm.polyglot.tck
Interface ResultVerifier
- All Superinterfaces:
Consumer<ResultVerifier.SnippetRun>
Allows a custom verification of a result of a snippet execution.
- Since:
- 0.30
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classProvides the test execution data. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ResultVerifier.SnippetRun snippetRun) Performs a verification of a result of a snippet execution.static ResultVerifierCreates a defaultResultVerifier.static ResultVerifierCreates a defaultResultVerifierfor theIdentityFunctionTest.
-
Method Details
-
accept
Performs a verification of a result of a snippet execution. The customResultVerifieroverrides the default snippet execution verification. The default verification tests that the result type is in bounds specified by theSnippet. The customResultVerifiercan be used to do additional checking of a result or an execution exception throwingAssertionErrorin case of failed assertion. The customResultVerifiercan hide an expected execution exception. For example the division operator snippet may provide a customResultVerifierhiding the execution exception for division by zero. To propagate the execution exception theResultVerifiershould re-throw it. TheResultVerifiercan be used to resolve problems in theErrorTypeTestby making theSnippet's parameter(s) more generic and restrict the required value in the verifier.- Specified by:
acceptin interfaceConsumer<ResultVerifier.SnippetRun>- Parameters:
snippetRun- the snippet execution data. TheResultVerifier.SnippetRunprovides the actual snippet parameters, the execution result, or thePolyglotExceptionthrown by the execution. If the snippet execution throws anIllegalArgumentException, it's converted toPolyglotException.- Throws:
org.graalvm.polyglot.PolyglotException- may propagate thePolyglotExceptionfrom the snippetRunAssertionError- may throw anAssertionErroras a result of a verification- Since:
- 0.30
-
getDefaultResultVerifier
Creates a defaultResultVerifier. The defaultResultVerifiertests that the result type is in bounds specified by theSnippet.- Returns:
- the default
ResultVerifier - Since:
- 19.0
-
getIdentityFunctionDefaultResultVerifier
Creates a defaultResultVerifierfor theIdentityFunctionTest. The returnedResultVerifiertests that the identity function does not change the parameter type.- Returns:
- the default
ResultVerifierforIdentityFunctionTest. - Since:
- 19.1.0
-