Runittotestthat
Convert RUnit tests to testthat tests
Install / Use
/learn @richierocks/RunittotestthatREADME
runittotestthat
Convert RUnit tests to testthat tests.
Installation
To install, you first need the devtools package.
install.packages("devtools")
Then you can install the runittotestthat package using
library(devtools)
install_github("richierocks/runittotestthat")
Converting tests
There are three functions of interest:
-
convert_testconverts an individualRUnittest to a call to atestthattest.test_truth <- function() { x <- all(runif(10) > 0) checkTrue(x) } convert_test(test_truth) ## test_that("test_truth", { ## x <- all(runif(10) > 0) ## expect_true(x) ## }) test_equality <- function() { x <- sqrt(1:5) expected <- c(1, 4, 9, 16, 25) checkEquals(expected, x ^ 4) } convert_test(test_equality) ## test_that("test_equality", { ## x <- sqrt(1:5) ## expected <- c(1, 4, 9, 16, 25) ## expect_equal(x^4, expected) ## }) test_error <- function() { checkException("1" + "2") } convert_test(test_error) ## test_that("test_error", { ## expect_error("1" + "2") ## }) -
convert_test_filesources all the tests in a file, converts each one, then outputs them to a file (or file connection;stdoutby default). -
convert_package_teststakes a string naming a package, or adevtools::packageobject and loops over the files ininst/tests(or wherever you specify), converting the tests, and outputting to files orstdout.
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
