Learn R Programming

gemini.R (version 0.15.0)

gen_tests: Generate Unit Tests for R Functions

Description

Generates unit test code for an R function using the Gemini AI model.

Usage

gen_tests(prompt = NULL)

Value

Invisibly returns the generated test code, but primarily inserts it into the RStudio console.

Arguments

prompt

A character string specifying additional instructions for the Gemini model. If NULL, a default prompt requesting unit tests is used.

Examples

Run this code
if (FALSE) {
# Select your function code in the editor, then run:
gen_tests()

# For custom instructions:
gen_tests("Generate comprehensive testthat tests with edge cases")
}

Run the code above in your browser using DataLab