assertCollectionAddin: Inserts code for a checkmate assert collection

View source: R/assert_collection_addin.R

assertCollectionAddinR Documentation

Inserts code for a checkmate assert collection

Description

\Sexpr[results=rd, stage=render]{lifecycle::badge("experimental")}

RStudio Addin: Inserts code for initializing and reporting a checkmate assert collection.

See `Details` for how to set a key command.

Usage

assertCollectionAddin(add_comments = TRUE, insert = TRUE, indentation = NULL)

Arguments

add_comments

Whether to add comments around. (Logical)

This makes it easy for a user to create their own addin without the comments.

insert

Whether to insert the code via rstudioapi::insertText() or return it. (Logical)

N.B. Mainly intended for testing the addin programmatically.

indentation

Indentation of the code. (Numeric)

N.B. Mainly intended for testing the addin programmatically.

Details

How to set up a key command in RStudio

After installing the package. Go to:

Tools >> Addins >> Browse Addins >> Keyboard Shortcuts.

Find "Insert checkmate AssertCollection Code" and press its field under Shortcut.

Press desired key command, e.g. Alt+C.

Press Apply.

Press Execute.

Value

Inserts the following (excluding the ----):

----

# Check arguments ####

assert_collection <- checkmate::makeAssertCollection()

# checkmate::assert_ , add = assert_collection)

checkmate::reportAssertions(assert_collection)

# End of argument checks ####

----

Returns NULL invisibly.

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

Other addins: dputSelectedAddin(), initializeGXSFunctionAddin(), initializeTestthatAddin(), insertExpectationsAddin(), navigateTestFileAddin(), wrapStringAddin()


xpectr documentation built on Nov. 18, 2022, 5:10 p.m.