From 10b6c43cf964d6976af4a467d2a272bae084a310 Mon Sep 17 00:00:00 2001 From: Samuel Livingstone Date: Mon, 8 Jun 2026 15:18:38 +0100 Subject: [PATCH 1/2] Adding initial implementation of greet function --- R/greet.R | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 R/greet.R diff --git a/R/greet.R b/R/greet.R new file mode 100644 index 0000000..f28699f --- /dev/null +++ b/R/greet.R @@ -0,0 +1,11 @@ +#' Greet a person by name +#' +#' @param name Name of person to greet +#' +#' @returns +#' @export +#' +#' @examples +greet <- function(name) { + cat(paste0("Hello ", name)) +} From 630337ab3e210119f3700673c4da1eaa419cf8cd Mon Sep 17 00:00:00 2001 From: Samuel Livingstone Date: Mon, 8 Jun 2026 16:03:40 +0100 Subject: [PATCH 2/2] Upload test function for greet function --- tests/testthat/test-greet.R | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tests/testthat/test-greet.R diff --git a/tests/testthat/test-greet.R b/tests/testthat/test-greet.R new file mode 100644 index 0000000..37b92f7 --- /dev/null +++ b/tests/testthat/test-greet.R @@ -0,0 +1,3 @@ +test_that("greet works", { + expect_output(greet("Matt"), "Hello Matt") +})