execute_script: Generate an environment from an R script

View source: R/execute_script.R

execute_scriptR Documentation

Generate an environment from an R script

Description

Execute a string as an R script and return the environment from that execution.

Converts a string to an AST and executes that script in a dummy environment for running test cases against. Transforms all expressions of the form . = ottr::check(...) by replacing the . with an index into a list in the environment with name ⁠check_results_{SECRET}⁠ to collect the TestFileResult objects generated from those checks. (This helps to handle variable name collisions in tests when grading a script.)

Usage

execute_script(script, ignore_errors)

Arguments

script

The string to be executed

ignore_errors

Whether to ignore errors thrown while executing the script

Value

The global environment after executing the script


ucbds-infra/ottr documentation built on Feb. 24, 2024, 2:31 a.m.