From c2fb85f167208272311188256fca2961ebdd96d3 Mon Sep 17 00:00:00 2001 From: farrugir Date: Wed, 29 Mar 2023 08:58:45 +0000 Subject: [PATCH] #1839 dummy function created --- R/my_first_fcn.R | 27 +++++++++++++++++++++++++++ tests/testthat/test-my_first_fcn.R | 13 +++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 R/my_first_fcn.R create mode 100644 tests/testthat/test-my_first_fcn.R diff --git a/R/my_first_fcn.R b/R/my_first_fcn.R new file mode 100644 index 0000000000..5876aa597e --- /dev/null +++ b/R/my_first_fcn.R @@ -0,0 +1,27 @@ +#' Derive Extension Example +#' +#' Says hello admiral +#' +#' @param hw TRUE or FALSE +#' +#' @author Open Source +#' +#' @details Something Something +#' +#' @return Happy Message +#' +#' @family der_adxx +#' +#' @keywords der_adxx +#' +#' @export +#' +#' @examples +#' hello_admiral(hw = FALSE) +hello_admiral <- function(hw = TRUE) { + if (hw) { + message("Welcome to the admiral family!") + } else { + message("Welcome to the admiral family!") + } +} diff --git a/tests/testthat/test-my_first_fcn.R b/tests/testthat/test-my_first_fcn.R new file mode 100644 index 0000000000..b1f7233e19 --- /dev/null +++ b/tests/testthat/test-my_first_fcn.R @@ -0,0 +1,13 @@ +test_that("hello admiral greets without hw", { + expect_message( + hello_admiral(), + "^Welcome to the admiral family!\\n" + ) +}) + +test_that("hello admiral greets with hw", { + expect_message( + hello_admiral(TRUE), + "^Welcome to the admiral family!\\n" + ) +})