Skip to content

Commit

Permalink
Nueva function greet()
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro-ixpantia committed Dec 6, 2024
1 parent d5b822f commit d099c8d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
URL: https://ixpantia.github.io/inc.rtests/
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
4 changes: 4 additions & 0 deletions R/greet.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
greet <- function(name = NULL) {
name <- name %||% "world"
paste("hello", name)
}
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(inc.rtests)

test_check("inc.rtests")
7 changes: 7 additions & 0 deletions tests/testthat/test-greet.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test_that("works", {
expect_equal(greet(), "hello world")
})

test_that("con 'Mauro' devuelve hello Mauro", {
expect_equal(greet('Mauro'), "hello Mauro")
})

0 comments on commit d099c8d

Please sign in to comment.