R/ctrl_shift_q.R

# ctrl_shift_q ------------------------------------------------------------
#
#' @title Run a Script Using a Keyboard Shortcut
#'
#' @description This function sources \code{~/test/testthat.R}.
#'
#' @details The function is designed to enhance RStudio test package keyboard
#'   shortcut \code{Ctrl+Shift+T}. Instead of running only the tests under
#'   \code{~/test/testthat}, the user can define testthat.R to run a full test
#'   suite.
#'
#' @export
#'
#' @family RStudio Addins
#'
ctrl_shift_q <- function() {# nocov start
    #################
    ## Source File ##
    #################
    ## Get project working directory
    path_tests <- getProject("path_tests")
    path_tests <- ifelse(is.null(path_tests),
                         file.path(getwd(), "tests", "testthat.R"),
                         file.path(path_tests, "testthat.R"))
    source(path_tests)


    ############
    ## Ruturn ##
    ############
    return(invisible())
}# nocov end
tidylab/tidylab.deployment documentation built on June 9, 2019, 11:41 a.m.